PersisterOne.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Test App Comment Model
  4. *
  5. *
  6. *
  7. * PHP 5
  8. *
  9. * CakePHP : Rapid Development Framework (http://cakephp.org)
  10. * Copyright 2005-2012, Cake Software Foundation, Inc.
  11. *
  12. * Licensed under The MIT License
  13. * Redistributions of files must retain the above copyright notice.
  14. *
  15. * @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
  16. * @link http://cakephp.org CakePHP Project
  17. * @package Cake.Test.test_app.Model
  18. * @since CakePHP v 1.2.0.7726
  19. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  20. */
  21. class PersisterOne extends AppModel {
  22. public $useTable = 'posts';
  23. public $name = 'PersisterOne';
  24. public $actsAs = array('PersisterOneBehavior', 'TestPlugin.TestPluginPersisterOne');
  25. public $hasMany = array('Comment', 'TestPlugin.TestPluginComment');
  26. public $validate = array(
  27. 'title' => array(
  28. 'custom' => array(
  29. 'rule' => array('custom', '.*'),
  30. 'allowEmpty' => true,
  31. 'required' => false,
  32. 'message' => 'Post title is required'
  33. ),
  34. 'between' => array(
  35. 'rule' => array('between', 5, 15),
  36. 'message' => array('You may enter up to %s chars (minimum is %s chars)', 14, 6)
  37. )
  38. ),
  39. 'body' => array(
  40. 'first_rule' => array(
  41. 'rule' => array('custom', '.*'),
  42. 'allowEmpty' => true,
  43. 'required' => false,
  44. 'message' => 'Post body is required'
  45. ),
  46. 'second_rule' => array(
  47. 'rule' => array('custom', '.*'),
  48. 'allowEmpty' => true,
  49. 'required' => false,
  50. 'message' => 'Post body is super required'
  51. )
  52. ),
  53. );
  54. }