Пример #1
0
 /**
  * Object constructor
  *
  * @param [array] $options Options to set as $this->key
  * @return [TerminusModel] $this
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     if (!isset($this->user)) {
         $this->user = new User(new stdClass(), array());
     }
 }
Пример #2
0
 /**
  * Fetches model data from API and instantiates its model instances
  *
  * @param [array] $options params to pass to url request
  * @return [SiteUserMemberships] $this
  */
 public function fetch($options = array())
 {
     if (!isset($options['paged'])) {
         $options['paged'] = true;
     }
     parent::fetch($options);
     return $this;
 }
Пример #3
0
 /**
  * Adds a model to this collection
  *
  * @param [stdClass] $model_data Data to feed into attributes of new model
  * @param [array]    $options    Data to make properties of the new model
  * @return [void]
  */
 protected function add($model_data, $options = array())
 {
     parent::add($model_data->attributes, $options);
 }
Пример #4
0
 /**
  * Fetches model data from API and instantiates its model instances
  *
  * @param [boolean] $paged True to use paginated API requests
  * @return [Workflows] $this
  */
 public function fetch($paged = false)
 {
     parent::fetch(true);
     return $this;
 }
Пример #5
0
 /**
  * Instantiates the collection, sets param members as properties
  *
  * @param [array] $options To be set to $this->key
  * @return [TerminusCollection] $this
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     $this->user = new User(new stdClass(), array());
     $this->workflows = new Workflows(array('owner' => $this, 'owner_type' => 'organization'));
 }
Пример #6
0
 /**
  * Adds a model to this collection
  *
  * @param object $model_data Data to feed into attributes of new model
  * @param array  $options    Data to make properties of the new model
  * @return void
  */
 public function add($model_data, array $options = array())
 {
     parent::add($model_data->attributes, $options);
 }
Пример #7
0
 /**
  * Adds a model to this collection
  *
  * @param [stdClass] $model_data Data to feed into attributes of new model
  * @param [array]    $options    Data to make properties of the new model
  * @return [mixed] $model newly added model
  */
 protected function add($model_data, $options = array())
 {
     $model = parent::add($model_data, $options = array());
     $model->owner = $this->owner;
     return $model;
 }
Пример #8
0
 /**
  * Instantiates the collection, sets param members as properties
  *
  * @param array $options To be set to $this->key
  * @return Sites
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     $this->sites_cache = new SitesCache();
     $this->user = Session::getUser();
 }
Пример #9
0
 /**
  * Adds a model to this collection
  *
  * @param object $model_data Data to feed into attributes of new model
  * @param array  $options    Data to make properties of the new model
  * @return Workflow  The newly-added model
  */
 public function add($model_data, array $options = array())
 {
     $model = parent::add($model_data, $options);
     $model->owner = $this->owner;
     return $model;
 }