Created
September 12, 2011 02:33
-
-
Save sergiopvilar/1210475 to your computer and use it in GitHub Desktop.
Models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Publication extends AppModel { | |
var $name = 'Publication'; | |
var $validate = array( | |
'uid' => array( | |
'notempty' => array( | |
'rule' => array('notempty'), | |
), | |
), | |
'account_id' => array( | |
'numeric' => array( | |
'rule' => array('numeric'), | |
), | |
), | |
'status' => array( | |
'numeric' => array( | |
'rule' => array('numeric'), | |
), | |
), | |
); | |
//The Associations below have been created with all possible keys, those that are not needed can be removed | |
var $belongsTo = array( | |
'Usuario' => array( | |
'className' => 'Usuario', | |
'foreignKey' => 'user_id', | |
'conditions' => '', | |
'fields' => '', | |
'order' => '' | |
), | |
'Account' => array( | |
'className' => 'Account', | |
'foreignKey' => 'account_id', | |
'conditions' => '', | |
'fields' => '', | |
'order' => '' | |
) | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Usuario extends AppModel { | |
var $name = 'Usuario'; | |
var $useTable = "usuarios"; | |
var $validate = array( | |
'name' => array( | |
'notempty' => array( | |
'rule' => array('notempty'), | |
'message' => 'O seu nome não pode estar vazio', | |
), | |
), | |
'username' => array( | |
'notempty' => array( | |
'rule' => array('alphaNumeric'), | |
'message' => 'Seu nome de usuário só pode conter letras e números', | |
), | |
), | |
'password' => array( | |
'notempty' => array( | |
'rule' => array('notempty'), | |
'message' => 'Você precisa digitar uma senha', | |
), | |
), | |
'email' => array( | |
'email' => array( | |
'rule' => array('email'), | |
'message' => 'Insira um email válido', | |
), | |
'isUnique'=>array( | |
'rule' => 'isUnique', | |
'message' => 'Este email já está cadastrado' | |
), | |
), | |
'level' => array( | |
'notempty' => array( | |
'rule' => array('notempty'), | |
), | |
), | |
'active' => array( | |
'numeric' => array( | |
'rule' => array('numeric'), | |
), | |
), | |
'lastlogin' => array( | |
'date' => array( | |
'rule' => array('date'), | |
), | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment