Ejemplo n.º 1
0
 /**
  * Initialize method
  *
  * @param array $config The configuration for the Table.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->table('photos');
     $this->displayField('id');
     $this->primaryKey('id');
     $this->belongsTo('Contents', ['foreignKey' => 'content_id', 'joinType' => 'INNER']);
 }
Ejemplo n.º 2
0
 /**
  * Initialize method
  *
  * @param array $config The configuration for the Table.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->table('categories');
     $this->displayField('title');
     $this->primaryKey('id');
     $this->addBehavior('Tree');
     $this->belongsTo('ParentCategories', ['className' => 'Categories', 'foreignKey' => 'parent_id']);
     $this->hasMany('ChildCategories', ['className' => 'Categories', 'foreignKey' => 'parent_id']);
     $this->hasMany('Contents', ['foreignKey' => 'category_id']);
 }