統計
| ブランチ: | リビジョン:

pictcode / lib / Cake / Test / test_app / Model / PersisterOne.php @ 635eef61

履歴 | 表示 | アノテート | ダウンロード (1.657 KB)

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