UniqueNotNullEntity
Validates the entity if properties are unique if it is not null, (*1)
Install
composer.json:, (*2)
"rodgermd/uniqueentitynotnull-bundle": "dev-master"
AppKernel.php:, (*3)
new Rodgermd\UniqueNotNullEntityBundle\RodgermdUniqueNotNullEntityBundle(),
Usage
~~~~~
use Rodgermd\UniqueNotNullEntityBundle\Validator as UniqueConstraints; # include namespace shortcut, (*4)
/**
* @ORM\Entity
* @UniqueConstraints\HasUniqueProperties; # defines the class has properties to check, required to start validation
*/
class Entity {, (*5)
/**
* @UniqueConstraints\UniqueProperty(message="Not unique property") # property to be validated
*/
protected $property;
}, (*6)