2017 © Pedro Peláez
 

nette-addon nette-symfony-validator

Integration of Symfony Validator component into Nette 2.

image

majkl578/nette-symfony-validator

Integration of Symfony Validator component into Nette 2.

  • Friday, April 12, 2013
  • by Majkl578
  • Repository
  • 2 Watchers
  • 6 Stars
  • 45 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Symfony Validator component & Nette 2

Nette addon for integrating Symfony Validator component into Nette 2., (*1)

Requirements

  • PHP 5.3.3 or newer
  • Symfony Validator 2.2
  • Doctrine Common 2.3
  • Nette 2.0
  • Doctrine ORM 2.3 (optional)

Installation

  • Add "majkl578/nette-symfony-validator" to your dependencies in composer.json. Don't forget to run composer update.
  • Register extension to start using this addon. Add the following call just before the call $configurator->createContainer():
Majkl578\NetteSymfonyValidator\Config\Extension::register($configurator);
  • If you want to use integration with Doctrine ORM, register also ORM extension:
Majkl578\NetteSymfonyValidator\Config\ORMExtension::register($configurator);
  • Delete cache.

You're done. ;), (*2)

General usage

Just use as normal service, e.g. autowire Symfony\Component\Validator\Validator. For more general usage, see Symfony 2 Validation documentation., (*3)

Doctrine 2 ORM

Validation is performed automatically only on new or changed entities. The validation is registered automatically through event listener. It is listening for preFlush event so the validation itself is performed after calling EntityManager::flush(), just before committing changes to database., (*4)

For more information about adding constraints to fields, see Properties in Symfony 2 Validation documentation. Here's just a simple example:, (*5)

namespace Example;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

class User
{
    /**
     * @ORM\Column
     * @Assert\NotBlank
     */
    private $name;

    /**
     * @ORM\Column
     * @Assert\NotBlank
     * @Assert\Email
     */
    private $email;

    // ...
}

Issues

In case of any problems, just leave an issue here on GitHub (or, better, send a pull request)., (*6)

The Versions

12/04 2013

dev-master

9999999-dev

Integration of Symfony Validator component into Nette 2.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Moravec

validator symfony nette addon

12/04 2013

1.1.0

1.1.0.0

Integration of Symfony Validator component into Nette 2.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Moravec

validator symfony nette addon

11/04 2013

1.0.0

1.0.0.0

Integration of Symfony Validator component into Nette 2.

  Sources   Download

MIT

The Requires

 

by Michael Moravec

validator symfony nette addon