Skip to content

Instantly share code, notes, and snippets.

View ahsio's full-sized avatar
🚀

Ahmed Siouani ahsio

🚀
View GitHub Profile
@ahsio
ahsio / Person.php
Created November 15, 2012 01:00
code snippet for custom validation constraint for two fields
class Person extends Constraint
{
/**
* (non-PHPdoc)
* @see Symfony\Component\Validator.Constraint::validatedBy()
*/
public function validatedBy()
{
return 'person_validator';
}
<?php
namespace Examplecms\Bundle\ExampleCoreBundle\Form\EventListener;
use Examplecms\Bundle\ExampleCoreBundle\Form\GroupTreeType;
use Symfony\Component\Form\Event\DataEvent,
Symfony\Component\Form\FormEvents,
Symfony\Component\Form\FormFactoryInterface,
Symfony\Component\EventDispatcher\EventSubscriberInterface;
<?php
namespace Examplecms\Bundle\ExampleCoreBundle\Form;
use Symfony\Component\Form\AbstractType,
Symfony\Component\Form\FormBuilder;
use Examplecms\Bundle\ExampleCoreBundle\Form\EventListener\SearchCriteriaSubscriber,
Examplecms\Bundle\ExampleCoreBundle\Validator\Constraints as ExamplecmsAssert;
/**