/** * 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()); } }
/** * 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; }
/** * 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); }
/** * 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; }
/** * 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')); }
/** * 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); }
/** * 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; }
/** * 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(); }
/** * 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; }