getRules() публичный Метод

Generate default rules checker.
public getRules ( Table $model, array $associations ) : array
$model Cake\ORM\Table The model to introspect.
$associations array The associations for the model.
Результат array The rules to be applied.
Пример #1
0
 /**
  * Tests baking a table with rules
  *
  * @return void
  */
 public function testBakeWithRules()
 {
     $model = TableRegistry::get('Users');
     $associations = ['belongsTo' => [['alias' => 'Countries', 'foreignKey' => 'country_id'], ['alias' => 'Sites', 'foreignKey' => 'site_id']], 'hasMany' => [['alias' => 'BakeComments', 'foreignKey' => 'bake_user_id']]];
     $rulesChecker = $this->Task->getRules($model, $associations);
     $result = $this->Task->bakeTable($model, compact('rulesChecker'));
     $this->assertSameAsFile(__FUNCTION__ . '.php', $result);
 }