예제 #1
0
 /**
  * {@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;
 }
예제 #2
0
 /**
  * {@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;
 }
예제 #4
0
파일: Model.php 프로젝트: zonky2/core
 /**
  * {@inheritDoc}
  */
 public function writeToPropertyValueBag(PropertyValueBagInterface $valueBag)
 {
     foreach ($this->getPropertyNames() as $property) {
         if (!$valueBag->hasPropertyValue($property)) {
             continue;
         }
         $valueBag->setPropertyValue($property, $this->getProperty($property));
     }
 }