Initial commit
This commit is contained in:
82
src/Model/Table/WlBudgetsTable.php
Normal file
82
src/Model/Table/WlBudgetsTable.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
namespace App\Model\Table;
|
||||
|
||||
use Cake\ORM\Query;
|
||||
use Cake\ORM\RulesChecker;
|
||||
use Cake\ORM\Table;
|
||||
use Cake\Validation\Validator;
|
||||
|
||||
/**
|
||||
* WlBudgets Model
|
||||
*
|
||||
* @property \App\Model\Table\BudgetTable|\Cake\ORM\Association\HasMany $Budget
|
||||
*
|
||||
* @method \App\Model\Entity\WlBudget get($primaryKey, $options = [])
|
||||
* @method \App\Model\Entity\WlBudget newEntity($data = null, array $options = [])
|
||||
* @method \App\Model\Entity\WlBudget[] newEntities(array $data, array $options = [])
|
||||
* @method \App\Model\Entity\WlBudget|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
|
||||
* @method \App\Model\Entity\WlBudget patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
|
||||
* @method \App\Model\Entity\WlBudget[] patchEntities($entities, array $data, array $options = [])
|
||||
* @method \App\Model\Entity\WlBudget findOrCreate($search, callable $callback = null, $options = [])
|
||||
*
|
||||
* @mixin \Cake\ORM\Behavior\TimestampBehavior
|
||||
*/
|
||||
class WlBudgetsTable extends Table
|
||||
{
|
||||
|
||||
/**
|
||||
* Initialize method
|
||||
*
|
||||
* @param array $config The configuration for the Table.
|
||||
* @return void
|
||||
*/
|
||||
public function initialize(array $config)
|
||||
{
|
||||
parent::initialize($config);
|
||||
|
||||
$this->setTable('wl_budgets');
|
||||
$this->setDisplayField('wl_kurz_bezeichnung');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->addBehavior('Timestamp');
|
||||
|
||||
$this->hasMany('Budget', [
|
||||
'foreignKey' => 'wl_budget_id'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default validation rules.
|
||||
*
|
||||
* @param \Cake\Validation\Validator $validator Validator instance.
|
||||
* @return \Cake\Validation\Validator
|
||||
*/
|
||||
public function validationDefault(Validator $validator)
|
||||
{
|
||||
$validator
|
||||
->integer('id')
|
||||
->allowEmpty('id', 'create');
|
||||
|
||||
$validator
|
||||
->scalar('wl_werteliste_nr')
|
||||
->maxLength('wl_werteliste_nr', 10)
|
||||
->allowEmpty('wl_werteliste_nr');
|
||||
|
||||
$validator
|
||||
->scalar('wl_kurz_bezeichnung')
|
||||
->maxLength('wl_kurz_bezeichnung', 30)
|
||||
->allowEmpty('wl_kurz_bezeichnung');
|
||||
|
||||
$validator
|
||||
->scalar('schulart')
|
||||
->maxLength('schulart', 10)
|
||||
->allowEmpty('schulart');
|
||||
|
||||
$validator
|
||||
->dateTime('modfied')
|
||||
->requirePresence('modfied', 'create')
|
||||
->notEmpty('modfied');
|
||||
|
||||
return $validator;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user