Skip to content

Commit

Permalink
Merge pull request #1 from umpirsky/taxonomies-validation
Browse files Browse the repository at this point in the history
Added validation.
  • Loading branch information
Paweł Jędrzejewski committed Dec 15, 2012
2 parents b7ff073 + fd579fc commit 3c21647
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Expand Up @@ -13,7 +13,6 @@

use Doctrine\Common\Persistence\ObjectRepository;
use Sylius\Bundle\TaxonomiesBundle\Form\DataTransformer\SelectionToTaxonsTransformer;
use Symfony\Bridge\Doctrine\Form\DataTransformer\CollectionToArrayTransformer;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
use Symfony\Component\Form\FormBuilderInterface;
Expand Down
13 changes: 13 additions & 0 deletions src/Sylius/Bundle/TaxonomiesBundle/Resources/config/validation.xml
Expand Up @@ -17,8 +17,21 @@
http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="Sylius\Bundle\TaxonomiesBundle\Model\Taxonomy">
<property name="root">
<constraint name="Valid" />
</property>
</class>

<class name="Sylius\Bundle\TaxonomiesBundle\Model\Taxon">
<property name="name">
<constraint name="NotBlank">
<option name="message">sylius_taxonomies.taxon.name.not_blank</option>
</constraint>
<constraint name="MaxLength">
<option name="limit">255</option>
<option name="message">sylius_taxonomies.taxon.name.max_length</option>
</constraint>
</property>
</class>

</constraint-mapping>
@@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

sylius_taxonomies:
taxon:
name:
not_blank: "Please enter taxon name"
max_length: "Taxon name must not be longer than 255 characters"

0 comments on commit 3c21647

Please sign in to comment.