Permalink
Browse files

Add note about ValidPhpcrOdm constraint validator in tutorial

  • Loading branch information...
EmmanuelVella committed Jan 16, 2013
1 parent 5334e0f commit 0f2e1b2fa5600bd3cf4343a0264a4d07599baf33
Showing with 30 additions and 0 deletions.
  1. +30 −0 tutorials/installing-configuring-doctrine-phpcr-odm.rst
@@ -325,3 +325,33 @@ trivial to register this type and the PHPCR namespace:
.. code-block:: bash
php app/console doctrine:phpcr:register-system-node-types
+
+Using the ValidPhpcrOdm constraint validator
+-----------------------------
+
+The bundle provides a ``ValidPhpcrOdm`` constraint validator you can use to check if your document ``Id`` or ``Nodename`` and ``Parent`` fields are correct :
+
+.. code-block:: php
+ <?php
+
+ namespace Acme\DemoBundle\Document;
+
+ use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
+ use Doctrine\Bundle\PHPCRBundle\Validator\Constraints as Assert;
+
+ /**
+ * @PHPCRODM\Document
+ * @Assert\ValidPhpcrOdm
+ */
+ class MyDocument
+ {
+ /** @PHPCRODM\Id(strategy="parent") */
+ protected $id;
+
+ /** @PHPCRODM\Nodename */
+ protected $name;
+
+ /** @PHPCRODM\ParentDocument */
+ protected $parent;
+
+ ...

0 comments on commit 0f2e1b2

Please sign in to comment.