public function __construct($app, $em)
 {
     /* @var $app Slim */
     Validator::addRule('unique_storename', function ($field, $value, array $params) use($em, $app) {
         $storename = $app->request->post('winkelnaam');
         $repo = $em->getRepository('digi\\eslTools\\Entities\\Store');
         $result = $repo->findBy(array('storename' => $storename));
         return count($result) < 1;
     }, 'bestaat al');
     parent::__construct($app, $em);
 }
 public function __construct($app, $em)
 {
     // custom rule unique email
     Validator::addRule('unique_email', function ($field, $value, array $params) use($em, $app) {
         $email = $app->request->post('e-mail');
         $repo = $em->getRepository('digi\\eslTools\\Entities\\User');
         $result = $repo->findBy(array('email' => $email));
         return count($result) < 1;
     }, 'bestaat al');
     // custom rule unique username
     Validator::addRule('unique_username', function ($field, $value, array $params) use($em, $app) {
         $username = $app->request->post('gebruikersnaam');
         $repo = $em->getRepository('digi\\eslTools\\Entities\\User');
         $result = $repo->findBy(array('username' => $username));
         return count($result) < 1;
     }, 'bestaat al');
     parent::__construct($app, $em);
     // custom rule
 }
Esempio n. 3
0
 public function __construct($app, $em)
 {
     parent::__construct($app, $em);
 }