rodgermd/uniqueentitynotnull-bundle

Check if entity is unique if not null

v0.1 2013-12-03 07:14 UTC

This package is not auto-updated.

Last update: 2024-12-17 03:30:20 UTC


README

Validates the entity if properties are unique if it is not null

Install

composer.json:

"rodgermd/uniqueentitynotnull-bundle": "dev-master"

AppKernel.php:

new Rodgermd\UniqueNotNullEntityBundle\RodgermdUniqueNotNullEntityBundle(),

Usage

use Rodgermd\UniqueNotNullEntityBundle\Validator as UniqueConstraints; # include namespace shortcut

/**
 * @ORM\Entity
 * @UniqueConstraints\HasUniqueProperties; # defines the class has properties to check, required to start validation
 */
class Entity {

  /**
   * @UniqueConstraints\UniqueProperty(message="Not unique property") # property to be validated
   */
  protected $property;
}