本文整理汇总了PHP中Nette\Forms\Container::getComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::getComponent方法的具体用法?PHP Container::getComponent怎么用?PHP Container::getComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Forms\Container
的用法示例。
在下文中一共展示了Container::getComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setContainerDefaults
/**
* @param Nette\Forms\Container $parent
* @param string $name
* @param mixed $values
*/
protected function setContainerDefaults(Nette\Forms\Container $parent, $name, $values)
{
if ($values === NULL) {
return;
}
$component = $parent->getComponent($name);
$factory = $this->getContainerFactory($name);
if ($values instanceof IFormEntity) {
$factory->setDefaultByEntity($component, $values);
} else {
$factory->setDefaultByCollection($component, $values);
}
}
示例2: relationBuilder
/**
* @param string $name
* @throws InvalidArgumentException
* @throws NotImplementedException
* @return EntityBuilder
*/
public function relationBuilder($name)
{
$class = $this->getMetadata();
if (!$class->hasAssociation($name)) {
throw new InvalidArgumentException("Entity {$this->metadata->name} has no association '{$name}'.");
}
if (isset($this->relationBuilders[$name])) {
return $this->relationBuilders[$name];
}
if ($class->isSingleValuedAssociation($name)) {
if (!$this->container->getComponent($name, FALSE)) {
$this->container->addComponent(new Nette\Forms\Container(), $name);
}
$builder = new EntityBuilder($this->container[$name], $this->mapper, $this->controlFactory, $this->em);
if ($this->entity && ($relation = $class->getFieldValue($this->entity, $name))) {
$builder->bindEntity($relation);
} else {
$builder->bindEntityType($class->getAssociationTargetClass($name));
}
return $this->relationBuilders[$name] = $builder;
} else {
throw new NotImplementedException();
}
}
示例3: getComponent
/**
* @param $name
* @param bool $need
* @return IComponent
*/
public function getComponent($name, $need = TRUE)
{
$this->createCopies();
return parent::getComponent($name, $need);
}