/** * Validates that the model type (from a Model or Collection instance) can be set to the relationship field. * * @param string $relKey The relationship field key. * @param string $type The model type that is being related. * @return self */ protected function validateRelSet($relKey, $type) { $relMeta = $this->getMetadata()->getRelationship($relKey); $relatedModelMeta = $this->store->getMetadataForRelationship($relMeta); $this->store->validateRelationshipSet($relatedModelMeta, $type); return $this; }
/** * Validates that the collection supports the incoming model. * * @param Model $model The model to validate. */ protected function validateAdd(Model $model) { $this->store->validateRelationshipSet($this->getMetadata(), $model->getType()); }