ValidationBehavior.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * Behavior for binding management.
  5. *
  6. * Behavior to simplify manipulating a model's bindings when doing a find operation
  7. *
  8. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  9. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  10. *
  11. * Licensed under The MIT License
  12. * For full copyright and license information, please see the LICENSE.txt
  13. * Redistributions of files must retain the above copyright notice.
  14. *
  15. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  16. * @link https://cakephp.org CakePHP(tm) Project
  17. * @since 3.5.0
  18. * @license https://www.opensource.org/licenses/mit-license.php MIT License
  19. */
  20. namespace TestApp\Model\Behavior;
  21. use Cake\ORM\Behavior;
  22. use Cake\Validation\Validator;
  23. /**
  24. * Description of ValidationBehavior
  25. */
  26. class ValidationBehavior extends Behavior
  27. {
  28. /**
  29. * @return $this
  30. */
  31. public function validationBehavior(Validator $validator)
  32. {
  33. return $validator->add('name', 'behaviorRule');
  34. }
  35. }