mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-03 08:09:25 +03:00
37efa7228b
* Adding format and example extensions. Getting child type better for collections Fixing copyrights Fixing style issues Fixing style issues Fixing style issues * Adding DocumentationExtension * Adding error for invalid properties * Reverting switch * Missing entity break * Removing unecessary doc * Removing unecessary method * Style change * Adding break for number, integer, and text types * Extracts the documentation form extension
40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
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\Form\Extension;
|
|
|
|
use Symfony\Component\Form\AbstractTypeExtension;
|
|
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
|
|
/**
|
|
* @author Aaron Scherer <aequasi@gmail.com>
|
|
*/
|
|
class DocumentationExtension extends AbstractTypeExtension
|
|
{
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
{
|
|
$builder->setAttribute('documentation', $options['documentation']);
|
|
}
|
|
|
|
public function configureOptions(OptionsResolver $resolver)
|
|
{
|
|
$resolver->setDefaults(['documentation' => []])
|
|
->setAllowedTypes('documentation', ['array']);
|
|
}
|
|
|
|
public function getExtendedType()
|
|
{
|
|
return FormType::class;
|
|
}
|
|
}
|