Quick question:
When you define, in your ORM column definition, that a column is of type string, for example. Is it of any use to also define a constraint that says that the type needs to be string?
Even more: is it a best practice to do so? Or is it just double work for nothing?
I would assume it is the first, since in this case you can catch the problem during validation, rather then during flushing. I think 🙂
Example code:
/**
* @var string $type
*
* @ORM\Column(name="type", type="string", length=255, nullable=false)
* @Assert\NotBlank()
* @Assert\Type(type="string")
*/
private $type;
After working with the constraint a bit, I’m pretty sure I answered my own question 🙂
So, yeah. There we go ^^ If anyone disagrees, please speak up!