Exemple #1
0
 public function initialize()
 {
     parent::initialize();
     $this->error = [];
     $this->fileSystem = new MediaFiles();
     $this->constants = new Constants();
 }
Exemple #2
0
 public function initialize()
 {
     parent::initialize();
     $this->hasMany('id', __NAMESPACE__ . '\\UsersBadges', 'usersId', ['alias' => 'badges', 'reusable' => true]);
     $this->hasMany('id', __NAMESPACE__ . '\\Posts', 'usersId', ['alias' => 'posts', 'reusable' => true]);
     $this->hasMany('id', __NAMESPACE__ . '\\PostsReply', 'usersId', ['alias' => 'replies', 'reusable' => true]);
     $this->hasMany('id', __NAMESPACE__ . '\\Vote', 'usersId', ['alias' => 'vote', 'reusable' => true]);
 }
Exemple #3
0
 /**
  * This method aids in setting up the model with a custom behavior i.e. a different table.
  * Is only called once during the request.
  */
 public function initialize()
 {
     parent::initialize();
     $this->useDynamicUpdate(true);
     $this->belongsTo('id', __NAMESPACE__ . '\\PostsHistory', 'postsId', ['alias' => 'postHistory']);
     $this->belongsTo('usersId', __NAMESPACE__ . '\\Users', 'id', ['alias' => 'user', 'reusable' => true]);
     $this->hasMany('id', __NAMESPACE__ . '\\Comment', 'objectId', ['alias' => 'comment']);
     $this->hasMany('id', __NAMESPACE__ . '\\PostsViews', 'postsId', ['alias' => 'postview']);
     $this->hasMany('id', __NAMESPACE__ . '\\PostsReply', 'postsId', ['alias' => 'replies']);
     $this->hasMany('id', __NAMESPACE__ . '\\PostsSubscribers', 'postsId', ['alias' => 'postSubscriber']);
     $this->hasManyToMany('id', __NAMESPACE__ . '\\PostsTags', 'postsId', 'tagsId', __NAMESPACE__ . '\\Tags', 'id', ['alias' => 'tag']);
     //SoftDelete api Phalcon
     $this->addBehavior(new SoftDelete(array('field' => 'deleted', 'value' => time())));
 }