示例#1
0
 protected function attached($form)
 {
     parent::attached($form);
     $this->fileEntity = Objects::hasProperty($this->parent->data, $this->name) ? Objects::getProperty($this->parent->data, $this->name) : NULL;
     if ($this->fileEntity instanceof \Doctrine\Common\Collections\Collection) {
         $this->multi = true;
     }
 }
示例#2
0
 /**
  */
 public function load()
 {
     foreach ($this->entities as $entity) {
         $class = $this->getMeta($entity);
         $container = $this->getComponent($entity);
         $values = new Nette\ArrayHash();
         foreach ($container->getControls() as $control) {
             $field = $this->getControlField($control);
             if (Objects::hasProperty($entity, $field)) {
                 $value = Objects::getProperty($entity, $field);
                 $values[$field] = $this->sanitizeValue($class, $field, $value);
             }
         }
         $container->setValues($values);
     }
 }