예제 #1
0
 /**
  * @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);
 }
예제 #2
0
 /**
  * @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);
     }
 }
예제 #3
0
 /**
  * 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);
     }
 }