Skip to content

Commit 2a0c66b

Browse files
committed
Seems that i have put the code to follow the CakePHP standard
To be honest i do not remember of these changes they were here at my local checkout, and i do not know what exactly i have done in this code, but looks that i have put into the cakephp standard. So i gonna push this as a develop branch of plugin, that's it! ;)
1 parent ed27b63 commit 2a0c66b

File tree

9 files changed

+1085
-1048
lines changed

9 files changed

+1085
-1048
lines changed

Config/Schema/schema.php

+78-80
Original file line numberDiff line numberDiff line change
@@ -12,87 +12,85 @@
1212
*/
1313
class AttachSchema extends CakeSchema
1414
{
15-
/**
16-
* Before callback
17-
*
18-
* @param Array $event Event
19-
*
20-
* @return Boolean
21-
*/
22-
public function before($event = array())
23-
{
24-
return true;
25-
}
2615

27-
/**
28-
* After callback
29-
*
30-
* @param Array $event Event
31-
*
32-
* @return Boolean
33-
*/
34-
public function after($event = array())
35-
{
36-
37-
}
38-
39-
public $attachments = array(
40-
41-
'id' => array(
42-
'type' => 'integer',
43-
'null' => false,
44-
'default' => null,
45-
'key' => 'primary',
46-
'collate' => null,
47-
'comment' => ''
48-
),
49-
50-
'filename' => array(
51-
'type' => 'string',
52-
'null' => false,
53-
'default' => null,
54-
'length' => 150,
55-
'collate' => 'utf8_general_ci',
56-
'comment' => '',
57-
'charset' => 'utf8'
58-
),
59-
60-
'model' => array(
61-
'type' => 'string',
62-
'null' => false,
63-
'default' => null,
64-
'length' => 150,
65-
'collate' => 'utf8_general_ci',
66-
'comment' => '',
67-
'charset' => 'utf8'
68-
),
69-
70-
'foreign_key' => array(
71-
'type' => 'integer',
72-
'null' => false,
73-
'default' => null,
74-
'collate' => null,
75-
'comment' => ''
76-
),
16+
/**
17+
* Attachments table
18+
*
19+
* @var array
20+
*/
21+
public $attachments = array(
22+
'id' => array(
23+
'type' => 'integer',
24+
'null' => false,
25+
'default' => null,
26+
'key' => 'primary',
27+
'collate' => null,
28+
'comment' => ''
29+
),
30+
'filename' => array(
31+
'type' => 'string',
32+
'null' => false,
33+
'default' => null,
34+
'length' => 150,
35+
'collate' => 'utf8_general_ci',
36+
'comment' => '',
37+
'charset' => 'utf8'
38+
),
39+
'model' => array(
40+
'type' => 'string',
41+
'null' => false,
42+
'default' => null,
43+
'length' => 150,
44+
'collate' => 'utf8_general_ci',
45+
'comment' => '',
46+
'charset' => 'utf8'
47+
),
48+
'foreign_key' => array(
49+
'type' => 'integer',
50+
'null' => false,
51+
'default' => null,
52+
'collate' => null,
53+
'comment' => ''
54+
),
55+
'type' => array(
56+
'type' => 'string',
57+
'null' => false,
58+
'default' => null,
59+
'length' => 100,
60+
'collate' => 'utf8_general_ci',
61+
'comment' => '',
62+
'charset' => 'utf8'
63+
),
64+
'indexes' => array(
65+
'PRIMARY' => array('column' => 'id', 'unique' => 1)
66+
),
67+
'tableParameters' => array(
68+
'charset' => 'utf8',
69+
'collate' => 'utf8_general_ci',
70+
'engine' => 'InnoDB'
71+
)
72+
);
7773

78-
'type' => array(
79-
'type' => 'string',
80-
'null' => false,
81-
'default' => null,
82-
'length' => 100,
83-
'collate' => 'utf8_general_ci',
84-
'comment' => '',
85-
'charset' => 'utf8'
86-
),
74+
/**
75+
* Before callback
76+
*
77+
* @param Array $event Event
78+
*
79+
* @return bool
80+
*/
81+
public function before($event = array()) {
82+
return true;
83+
}
8784

88-
'indexes' => array(
89-
'PRIMARY' => array('column' => 'id', 'unique' => 1)
90-
),
85+
/**
86+
* After callback
87+
*
88+
* @param Array $event Event
89+
*
90+
* @return bool
91+
*/
92+
public function after($event = array()) {
93+
reutrn true;
94+
}
9195

92-
'tableParameters' => array(
93-
'charset' => 'utf8',
94-
'collate' => 'utf8_general_ci',
95-
'engine' => 'InnoDB'
96-
)
97-
);
98-
}
96+
}

Model/Attachment.php

+31-48
Original file line numberDiff line numberDiff line change
@@ -12,54 +12,37 @@
1212
* @author Vinícius Krolow <[email protected]>
1313
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
1414
*/
15-
class Attachment extends AppModel
16-
{
17-
/**
18-
* Display field
19-
*
20-
* @var string
21-
*/
22-
public $displayField = 'id';
15+
class Attachment extends AppModel {
2316

24-
/**
25-
* Validation rules
26-
*
27-
* @var array
28-
*/
29-
public $validate = array(
30-
'filename' => array(
31-
'notempty' => array(
32-
'rule' => array('notempty'),
33-
'message' => 'Filename cannot be empty',
34-
//'allowEmpty' => false,
35-
//'required' => false,
36-
//'last' => false, // Stop validation after this rule
37-
//'on' => 'create', // Limit validation to 'create' or
38-
//'update' operations
39-
),
40-
),
41-
'model' => array(
42-
'notempty' => array(
43-
'rule' => array('notempty'),
44-
//'message' => 'Your custom message here',
45-
//'allowEmpty' => false,
46-
//'required' => false,
47-
//'last' => false, // Stop validation after this rule
48-
//'on' => 'create', // Limit validation to 'create' or
49-
//'update' operations
50-
),
51-
),
52-
'foreign_key' => array(
53-
'numeric' => array(
54-
'rule' => array('numeric'),
55-
//'message' => 'Your custom message here',
56-
//'allowEmpty' => false,
57-
//'required' => false,
58-
//'last' => false, // Stop validation after this rule
59-
//'on' => 'create', // Limit validation to 'create' or
60-
//'update' operations
61-
),
62-
),
63-
);
17+
/**
18+
* Display field
19+
*
20+
* @var string
21+
*/
22+
public $displayField = 'id';
23+
24+
/**
25+
* Validation rules
26+
*
27+
* @var array
28+
*/
29+
public $validate = array(
30+
'filename' => array(
31+
'notempty' => array(
32+
'rule' => array('notempty'),
33+
'message' => 'Filename cannot be empty',
34+
),
35+
),
36+
'model' => array(
37+
'notempty' => array(
38+
'rule' => array('notempty'),
39+
),
40+
),
41+
'foreign_key' => array(
42+
'numeric' => array(
43+
'rule' => array('numeric'),
44+
),
45+
),
46+
);
6447
}
6548

0 commit comments

Comments
 (0)