Guilhem Niot a6f25da106
Detect when a model is used for a form type (#1834)
* Detect when a model is used for a form type

* typo

* Add a test + Fix implementation

* CS
2022-06-10 22:41:24 +02:00

33 lines
910 B
PHP

<?php
/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nelmio\ApiDocBundle\Tests\Functional\Form;
use Nelmio\ApiDocBundle\Annotation\Model;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\User;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class FormWithModel extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('quz', TextType::class, ['documentation' => ['ref' => new Model(['type' => User::class])]]);
}
public function configureOptions(OptionsResolver $resolver)
{
}
}