本文整理汇总了PHP中Symfony\Component\Form\AbstractType::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractType::getName方法的具体用法?PHP AbstractType::getName怎么用?PHP AbstractType::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\AbstractType
的用法示例。
在下文中一共展示了AbstractType::getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formEncode
public function formEncode($entity, Form $form, AbstractType $formType)
{
$baseName = $formType->getName();
$payload = array();
foreach ($form->getIterator() as $el) {
if (is_array($entity)) {
$payload[$baseName . '[' . $el->getName() . ']'] = $entity[$el->getName()];
}
}
return $payload;
}
示例2: getEntityErrorMap
protected function getEntityErrorMap($entity, AbstractType $formType = null)
{
/** @var ConstraintViolation[] $errors */
$errors = $this->get('validator')->validate($entity);
$mapping = [];
foreach ($errors as $err) {
if ($formType === null) {
$mapping[$err->getPropertyPath()] = $err->getMessage();
} else {
$mapping[$formType->getName() . '_' . $err->getPropertyPath()] = $err->getMessage();
}
}
return $mapping;
}
示例3: getFiltersForm
/**
* @param AbstractType $type
* @return \Symfony\Component\Form\Form
*/
public function getFiltersForm($type)
{
if ($this->getRequest()->request->get('reset')) {
$this->getRequest()->getSession()->set($type->getName() . '.filters', array());
}
$filters = $this->getRequest()->getSession()->get($type->getName() . '.filters', array());
if (is_array($filters)) {
foreach ($filters as $key => $filter) {
if (is_object($filter)) {
$filters[$key] = $this->entityManager->merge($filter);
}
}
}
$filters_form = $this->formFactory->create($type, $filters);
if (!$this->getRequest()->request->get('reset')) {
$filters_form->handleRequest($this->getRequest());
if ($filters_form->isValid()) {
$filters = $filters_form->getData();
$this->getRequest()->getSession()->set($type->getName() . '.filters', $filters);
}
}
return $filters_form;
}
示例4: addFilter
public function addFilter(AbstractType $filter)
{
$this->filters[$filter->getName()] = $filter;
}
示例5: assertTitle
public function assertTitle($expectedTitle)
{
$this->checkSetup();
$this->assertEquals($expectedTitle, $this->formType->getName());
}