/** * {@inheritDoc} */ public function writeToPropertyValueBag(PropertyValueBagInterface $valueBag) { foreach (array_keys($this->arrProperties) as $name) { if (!$valueBag->hasPropertyValue($name)) { continue; } $valueBag->setPropertyValue($name, $this->getProperty($name)); } return $this; }
/** * {@inheritDoc} */ public function writeToPropertyValueBag(PropertyValueBagInterface $valueBag) { $entity = $this->getEntity(); if ($entity) { $entityAccessor = $this->getEntityAccessor(); $properties = $entityAccessor->getProperties($entity); foreach ($properties as $name => $value) { if (!$valueBag->hasPropertyValue($name)) { continue; } if ($value instanceof EntityInterface) { $value = $entityAccessor->getPrimaryKey($value); } elseif (is_resource($value)) { $value = stream_get_contents($value); } $valueBag->setPropertyValue($name, $value); } } return $this; }
/** * Write values to a value bag. * * @param PropertyValueBagInterface $valueBag The value bag where to write to. * * @return ModelInterface */ public function writeToPropertyValueBag(PropertyValueBagInterface $valueBag) { $properties = array_keys($this->model->row()); foreach ($properties as $name) { if (!$valueBag->hasPropertyValue($name)) { continue; } $valueBag->setPropertyValue($name, $this->getProperty($name)); } return $this; }
/** * {@inheritDoc} */ public function writeToPropertyValueBag(PropertyValueBagInterface $valueBag) { foreach ($this->getPropertyNames() as $property) { if (!$valueBag->hasPropertyValue($property)) { continue; } $valueBag->setPropertyValue($property, $this->getProperty($property)); } }