/** * @param ResourceTransformer $transformer * @param PropertyResolver $propertyResolver * @param PropertySetter $propertySetter * @param $entity * @param RelationshipField $field * @param PropertyValues[] $identifiers * @param Context $context * @return mixed */ protected function removeAllChildrenExcept(ResourceTransformer $transformer, PropertyResolver $propertyResolver, PropertySetter $propertySetter, $entity, RelationshipField $field, array $identifiers, Context $context) { $propertySetter->removeAllChildrenExcept($transformer, $propertyResolver, $entity, $field, $identifiers, $context); }
/** * @param ResourceTransformer $transformer * @param PropertyResolver $propertyResolver * @param PropertySetter $propertySetter * @param $entity * @param RelationshipField $field * @param PropertyValues[] $identifiers * @param Context $context * @return mixed */ protected function removeAllChildrenExcept(ResourceTransformer $transformer, PropertyResolver $propertyResolver, PropertySetter $propertySetter, $entity, RelationshipField $field, array $identifiers, Context $context) { // Only one value allowed, so if $identifiers is empty, clear value if (empty($identifiers)) { $propertySetter->clearChild($transformer, $entity, $field, $context); } }
/** * Set a value in an entity * @param $entity * @param ResourceTransformer $resourceTransformer * @param PropertyResolver $propertyResolver * @param PropertySetter $propertySetter * @param EntityFactory $factory * @param Context $context */ public function toEntity($entity, ResourceTransformer $resourceTransformer, PropertyResolver $propertyResolver, PropertySetter $propertySetter, EntityFactory $factory, Context $context) { if ($this->field->canSetProperty()) { $propertySetter->setEntityValue($resourceTransformer, $entity, $this->field, $this->value, $context); } }