Limit database input choice using Doctrine

I have something like this:

 * @var string
 * @ORMColumn(name="item", type="string", length=255, nullable=true)
 * @JMSSType("string")
protected $item;

I need to somehow limit what can be written into $item. Something like:

* @Allowed {'Peter', 'Jack', 'Adam' }

So only Peter, Jack or Adam could be written on the DB

I see no way to do this after reading the documentation. Any help?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *