/** * Instantiates the collection, sets param members as properties * * @param array $options Options with which to configure this collection */ public function __construct(array $options = []) { parent::__construct($options); if (isset($options['environment'])) { $this->owner = $this->environment = $options['environment']; } elseif (isset($options['organization'])) { $this->owner = $this->organization = $options['organization']; } elseif (isset($options['site'])) { $this->owner = $this->site = $options['site']; } elseif (isset($options['user'])) { $this->owner = $this->user = $options['user']; } }
/** * Instantiates the collection * * @param array $options To be set * @return OrganizationSiteMemberships */ public function __construct(array $options = []) { parent::__construct($options); $this->organization = $options['organization']; $this->url = "organizations/{$this->organization->id}/memberships/sites"; }
/** * @inheritdoc */ public function getUrl() { return str_replace('{site_id}', $this->getSite()->id, parent::getUrl()); }
/** * @inheritdoc */ public function getUrl() { return $this->replaceUrlTokens(parent::getUrl()); }
/** * 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 TerminusModel */ public function add($model_data, array $options = []) { $model = parent::add($model_data, $options); $model->setDataStore($this->getDataStore()); return $model; }
/** * @inheritdoc */ public function getUrl() { // Replace the {user_id} token with the actual user id. return str_replace('{user_id}', $this->getUser()->get('id'), parent::getUrl()); }
/** * @inheritdoc */ public function __construct($options = []) { $this->org_site_membership = $options['org_site_membership']; parent::__construct($options); }
/** * Instantiates the collection, sets param members as properties * * @param array $options To be set to $this->key * @return Sites */ public function __construct(array $options = []) { parent::__construct($options); }