I have a simple form that takes a very long time :
$builder->add('manufacturer', 'entity', array(
'class' => 'XBundle\Entity\Manufacturer',
....
))
->add('type','entity', array(
'class' => 'XBundle\Entity\Entity\Type',
))
->add('size','entity', array(
'class' => 'XBundle\Entity\Size',
))
->add('serial', 'text', array(
'required'=>true,
))
;
After installing xhproof
and investigating the problem I found out that the validation is taking a big amount of time.
/**
* @ORM\ManyToOne(targetEntity="Ttm\HardwareBundle\Entity\Manufacturer", inversedBy="models")
* @Assert\Valid() <--- this line is the problem
*/
private $manufacturer;
Symfony2's documentation about valid annotation is not very clear:
traverse
type:
boolean
default:true
If this constraint is applied to a property that holds an array of objects, then each object in that array will be validated only if this option is set to true.
deep
type:
boolean
default:false
If this constraint is applied to a property that holds an array of objects, then each object in that array will be validated recursively if this option is set to true.
Source: http://symfony.com/doc/current/reference/constraints/Valid.html
My question is, What's the difference between the two options and which values guarantee to me a better performance ?