Archive for June, 2013

TYPO3 Flow: Creating a unique model property using annotations

In order to create a unique property of a TYPO3 Flow model, just a uniqueConstraint like this:

...
/**
 * @Flow\Entity
 * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="code_unique", columns={"code"})})
 */
class Code {
...

In this case, the code_unique is only defining the name of the constraint and code is the model property that should be unique.

Easy – if you know how it works 😉