本文整理汇总了PHP中Nette\Forms\Container::setCurrentGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::setCurrentGroup方法的具体用法?PHP Container::setCurrentGroup怎么用?PHP Container::setCurrentGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Forms\Container
的用法示例。
在下文中一共展示了Container::setCurrentGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
public function handle($name, array $options, ClassMetadata $classMetadata, Configuration $configuration)
{
if (!($mapping = MetadataHelpers::getAssociationMapping($classMetadata, $name, ClassMetadata::ONE_TO_MANY))) {
return NULL;
}
$options += ['createDefault' => 0];
$dao = $this->entityManager->getDao($mapping['targetEntity']);
$containerPrototype = new Container();
$replicator = new ClonnableReplicator(function (Container $container) use($containerPrototype) {
$clone = function (Container $targetContainer, Container $sourceContainer) use(&$clone) {
/** @var IComponent $component */
foreach ($sourceContainer->getComponents() as $component) {
if ($component instanceof Container && !$component instanceof ClonnableReplicator) {
/** @var Container $component */
$container = new Container();
$container->setCurrentGroup($component->getCurrentGroup());
$container->onValidate = $component->onValidate;
$targetContainer[$component->getName()] = $container;
$clone($container, $component);
} else {
$targetContainer[$component->getName()] = $control = clone $component;
if ($control instanceof BaseControl) {
$clonner = function () {
/** @var BaseControl $this */
$this->control = clone $this->control;
$this->label = clone $this->label;
};
$clonner = $clonner->bindTo($control, $control);
$clonner();
}
}
}
};
$clone($container, $containerPrototype);
}, $options['createDefault']);
return new ReplicatorBuilder($dao->getClassMetadata(), $replicator, $configuration, $containerPrototype);
}