예제 #1
0
 /**
  * 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');
 }
예제 #2
0
 /**
  * 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');
 }
예제 #4
0
 /**
  * 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']]);
 }
예제 #5
0
 /**
  * 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']]);
 }
예제 #6
0
 /**
  * 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']]);
 }
예제 #7
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('Albums', ['foreignKey' => 'album_id', 'joinType' => 'INNER', 'className' => 'MeCms.PhotosAlbums']);
     $this->addBehavior('Timestamp');
     $this->addBehavior('CounterCache', ['Albums' => ['photo_count']]);
 }
예제 #8
0
 /**
  * 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']]);
 }
예제 #9
0
 /**
  * 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');
 }
예제 #10
0
 /**
  * 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']]);
 }
예제 #11
0
 /**
  * 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');
 }