/** * Initialize method * @param array $config The configuration for the table * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('tags'); $this->displayField('tag'); $this->primaryKey('id'); $this->belongsToMany('Posts', ['foreignKey' => 'tag_id', 'targetForeignKey' => 'post_id', 'joinTable' => 'posts_tags', 'className' => 'MeCms.Posts', 'through' => 'MeCms.PostsTags']); $this->addBehavior('Timestamp'); }
/** * Initialize method * @param array $config The configuration for the table * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('users_groups'); $this->displayField('label'); $this->primaryKey('id'); $this->hasMany('Users', ['foreignKey' => 'group_id', 'className' => 'MeCms.Users']); $this->addBehavior('Timestamp'); }
/** * Initialize method * @param array $config The configuration for the table * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('banners_positions'); $this->displayField('title'); $this->primaryKey('id'); $this->hasMany('Banners', ['foreignKey' => 'position_id', 'className' => 'MeCms.Banners']); $this->addBehavior('Timestamp'); }
/** * Initialize method * @param array $config The configuration for the table * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('posts_tags'); $this->displayField('id'); $this->primaryKey('id'); $this->belongsTo('Tags', ['foreignKey' => 'tag_id', 'joinType' => 'INNER', 'className' => 'MeCms.Tags']); $this->belongsTo('Posts', ['foreignKey' => 'post_id', 'joinType' => 'INNER', 'className' => 'MeCms.Posts']); $this->addBehavior('CounterCache', ['Tags' => ['post_count']]); }
/** * Initialize method * @param array $config The configuration for the table * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('pages'); $this->displayField('title'); $this->primaryKey('id'); $this->belongsTo('Categories', ['foreignKey' => 'category_id', 'joinType' => 'INNER', 'className' => 'MeCms.PagesCategories']); $this->addBehavior('Timestamp'); $this->addBehavior('CounterCache', ['Categories' => ['page_count']]); }
/** * Initialize method * @param array $config The configuration for the table * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('banners'); $this->displayField('id'); $this->primaryKey('id'); $this->belongsTo('Positions', ['foreignKey' => 'position_id', 'joinType' => 'INNER', 'className' => 'MeCms.BannersPositions']); $this->addBehavior('Timestamp'); $this->addBehavior('CounterCache', ['Positions' => ['banner_count']]); }
/** * 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('Albums', ['foreignKey' => 'album_id', 'joinType' => 'INNER', 'className' => 'MeCms.PhotosAlbums']); $this->addBehavior('Timestamp'); $this->addBehavior('CounterCache', ['Albums' => ['photo_count']]); }
/** * Initialize method * @param array $config The configuration for the table * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('posts'); $this->displayField('title'); $this->primaryKey('id'); $this->belongsTo('Categories', ['foreignKey' => 'category_id', 'joinType' => 'INNER', 'className' => 'MeCms.PostsCategories']); $this->belongsTo('Users', ['foreignKey' => 'user_id', 'joinType' => 'INNER', 'className' => 'MeCms.Users']); $this->belongsToMany('Tags', ['foreignKey' => 'post_id', 'targetForeignKey' => 'tag_id', 'joinTable' => 'posts_tags', 'className' => 'MeCms.Tags', 'through' => 'MeCms.PostsTags']); $this->addBehavior('Timestamp'); $this->addBehavior('CounterCache', ['Categories' => ['post_count'], 'Users' => ['post_count']]); }
/** * Initialize method * @param array $config The configuration for the table * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('photos_albums'); $this->displayField('title'); $this->primaryKey('id'); $this->hasMany('Photos', ['foreignKey' => 'album_id', 'className' => 'MeCms.Photos']); $this->addBehavior('Timestamp'); }
/** * Initialize method * @param array $config The configuration for the table * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('users'); $this->displayField('full_name'); $this->primaryKey('id'); $this->belongsTo('Groups', ['foreignKey' => 'group_id', 'joinType' => 'INNER', 'className' => 'MeCms.UsersGroups']); $this->hasMany('Posts', ['foreignKey' => 'user_id', 'className' => 'MeCms.Posts']); $this->hasMany('Tokens', ['foreignKey' => 'user_id', 'className' => 'Tokens.Tokens']); $this->addBehavior('Timestamp'); $this->addBehavior('CounterCache', ['Groups' => ['user_count']]); }
/** * Initialize method * @param array $config The configuration for the table * @return void */ public function initialize(array $config) { parent::initialize($config); $this->table('pages_categories'); $this->displayField('title'); $this->primaryKey('id'); $this->belongsTo('Parents', ['className' => 'MeCms.PagesCategories', 'foreignKey' => 'parent_id']); $this->hasMany('Childs', ['className' => 'MeCms.PagesCategories', 'foreignKey' => 'parent_id']); $this->hasMany('Pages', ['className' => 'MeCms.Pages', 'foreignKey' => 'category_id']); $this->addBehavior('Timestamp'); $this->addBehavior('MeCms.Tree'); }