public function getRule(Component $component)
 {
     if ($component->hasValidatorRule()) {
         return $this->createRule($component->getValidatorRule());
     } elseif (($type = $component->getType()) != NULL) {
         try {
             return $this->typeRuleMapper->getRule($type);
             // schmeiss exception wenn das nicht geht
         } catch (TypeExportException $e) {
             throw new TypeExportException('Für ' . $component . ' mit dem Type: ' . $type . ' kann keine ValidatorRule zurückgegeben werden. Der Type hat ebenfalls keine gemappte ValidatorRule. Die Component sollte $this->validatorRule setzen.', 0, $e);
         }
     } else {
         throw new TypeExportException('Für ' . $component . ' kann keine ValidatorRule zurückgegeben werden, da der Type nicht gesetzt ist und hasValidatorRule() FALSE zurückgibt');
     }
 }
Exemple #2
0
 protected function setSubFormName(Component $component, $subComponent = NULL)
 {
     if (isset($subComponent)) {
         $component->setFormName(array($this->getFormName(), $subComponent));
     } else {
         $component->setFormName($this->getFormName());
     }
 }
 public function onComponentCreated(Component $component, ComponentsCreater $creater, Event $event)
 {
     $entityMeta = $this->getEntityMeta();
     $propertyMeta = $entityMeta->getPropertyMeta($event->getData()->name);
     if (($hint = $propertyMeta->getHint()) !== NULL) {
         $event->getData()->hint = $hint;
         $component->setHint($hint);
     }
     if ($propertyMeta->isRelation()) {
         $relationEntityMeta = $this->getEntityMeta($propertyMeta->getRelationEntityClass()->getFQN());
         $this->onEntityRelationComponentCreated($component, $creater, $event, $relationEntityMeta);
     }
     // Rufe on{$Property}ComponentCreated  auf, wenn es die Methode gibt
     $method = 'on' . $propertyMeta->getName() . 'ComponentCreated';
     if (method_exists($this, $method)) {
         $this->{$method}($component, $creater, $event);
     }
 }