public function put($relationship, $model) { if ($model != null && is_a($model, 'SpectrumModel')) { if (is_a($relationship, 'SpectrumParentRelationship')) { if (!array_key_exists($relationship->relationshipName, $this->parents)) { $this->parents[$relationship->relationshipName] = $model; } } else { if (is_a($relationship, 'SpectrumChildRelationship')) { if (!array_key_exists($relationship->relationshipName, $this->children)) { $this->children[$relationship->relationshipName] = SpectrumCollection::forge($relationship->modelType); } $this->children[$relationship->relationshipName]->put($model); } } } }
public function fetchCollection() { $entities = $this->fetch(); return SpectrumCollection::forge($this->modelType, null, $entities); }