本文整理汇总了PHP中Zend\Form\Annotation\AnnotationBuilder::setEventManager方法的典型用法代码示例。如果您正苦于以下问题:PHP AnnotationBuilder::setEventManager方法的具体用法?PHP AnnotationBuilder::setEventManager怎么用?PHP AnnotationBuilder::setEventManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Annotation\AnnotationBuilder
的用法示例。
在下文中一共展示了AnnotationBuilder::setEventManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
/**
* @param ContainerInterface $container
* @param string $name
* @param null|array $options
* @return AnnotationBuilder
* @throws ServiceNotCreatedException for invalid listener configuration.
*/
public function __invoke(ContainerInterface $container, $name, array $options = null)
{
//setup a form factory which can use custom form elements
$annotationBuilder = new AnnotationBuilder();
$eventManager = $container->get('EventManager');
$annotationBuilder->setEventManager($eventManager);
$this->injectFactory($annotationBuilder->getFormFactory(), $container);
$config = $this->marshalConfig($container);
if (isset($config['preserve_defined_order'])) {
$annotationBuilder->setPreserveDefinedOrder($config['preserve_defined_order']);
}
$this->injectAnnotations($config, $annotationBuilder);
$this->injectListeners($config, $eventManager, $container);
return $annotationBuilder;
}
示例2: setEventManager
/**
* {@inheritDoc}
*/
public function setEventManager(EventManagerInterface $events)
{
parent::setEventManager($events);
$this->getEventManager()->attach(new ElementAnnotationsListener($this->objectManager));
return $this;
}