setTable('formules'); $this->setDisplayField('id'); $this->setPrimaryKey('id'); $this->belongsTo('Fichemetrologiques', [ 'foreignKey' => 'formule_id' ]); $this->hasMany('Variables', [ 'foreignKey' => 'formule_id', 'dependent' => true ]); } /** * 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'); return $validator; } }