Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function readFromPropertyValueBag(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 ($valueBag->isPropertyValueInvalid($name)) {
                 throw new DcGeneralInvalidArgumentException('The value for property ' . $name . ' is invalid.');
             }
             $entityAccessor->setProperty($entity, $name, $valueBag->getPropertyValue($name));
         }
         $this->setMeta($this::IS_CHANGED, true);
     }
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  *
  * @throws DcGeneralInvalidArgumentException When a property in the value bag has been marked as invalid.
  */
 public function readFromPropertyValueBag(PropertyValueBagInterface $valueBag)
 {
     foreach (array_keys($this->arrProperties) as $name) {
         if (!$valueBag->hasPropertyValue($name)) {
             continue;
         }
         if ($valueBag->isPropertyValueInvalid($name)) {
             throw new DcGeneralInvalidArgumentException('The value for property ' . $name . ' is invalid.');
         }
         $this->setProperty($name, $valueBag->getPropertyValue($name));
     }
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * {@inheritDoc}
  *
  * @throws DcGeneralInvalidArgumentException When a property in the value bag has been marked as invalid.
  */
 public function readFromPropertyValueBag(PropertyValueBagInterface $valueBag)
 {
     foreach ($this->getPropertyNames() as $property) {
         if (!$valueBag->hasPropertyValue($property)) {
             continue;
         }
         if ($valueBag->isPropertyValueInvalid($property)) {
             throw new DcGeneralInvalidArgumentException('The value for property ' . $property . ' is invalid.');
         }
         $this->setProperty($property, $valueBag->getPropertyValue($property));
     }
 }