polderknowledge/entityservice-zend-validator

This library provides Zend\Validator support for the polderknowledge/entityservice library

1.0.1 2017-10-20 09:55 UTC

This package is auto-updated.

Last update: 2024-12-12 05:18:11 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

This library provides Zend\Validator support for the polderknowledge/entityservice library

Install

Via Composer

$ composer require polderknowledge/entityservice-zend-validator

Usage

After you have configured the EntityService you can use the validators without further config:

namespace MyApp\InputFilter;

use PolderKnowledge\EntityService\Validator\EntityExists;
use Zend\InputFilter\InputFilter;
use PonyApp\Entity\Pony;

class PonyEditInputFilter extends InputFilter
{
    /**
     * Initializes the input filter.
     */
    public function init()
    {
        $this->add([
            'name' => 'ponyId',
            'validators' => [
                [
                    'name' => EntityExists::class, // or EntityNotExists
                    'options' => [
                        'entity' => Pony::class,
                        'field' => 'name', // defaults to id 
                    ],
                ],
            ],
        ]);
    }
}

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please report them via HackerOne instead of using the issue tracker or e-mail.

Community

We have an IRC channel where you can find us every now and then. We're on the Freenode network in the channel #polderknowledge.

Credits

License

Please see LICENSE.md for the license of this application.