Nette\ComponentModel\Component::getName PHP Method

getName() public method

public getName ( ) : string
return string
    public function getName()
    {
        return $this->name;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function save(ClassMetadata $meta, Component $component, $entity)
 {
     if (!$component instanceof ToManyContainer) {
         return FALSE;
     }
     if (!($collection = $this->getCollection($meta, $entity, $component->getName()))) {
         return FALSE;
     }
     $em = $this->mapper->getEntityManager();
     $class = $meta->getAssociationTargetClass($component->getName());
     $relationMeta = $em->getClassMetadata($class);
     /** @var Nette\Forms\Container $container */
     foreach ($component->getComponents(FALSE, 'Nette\\Forms\\Container') as $container) {
         $isNew = substr($container->getName(), 0, strlen(ToManyContainer::NEW_PREFIX)) === ToManyContainer::NEW_PREFIX;
         $name = $isNew ? substr($container->getName(), strlen(ToManyContainer::NEW_PREFIX)) : $container->getName();
         if (!($relation = $collection->get($name))) {
             // entity was added from the client
             if (!$component->isAllowedRemove()) {
                 continue;
             }
             $collection[$name] = $relation = $relationMeta->newInstance();
         }
         $this->mapper->save($relation, $container);
     }
     return TRUE;
 }
All Usage Examples Of Nette\ComponentModel\Component::getName