Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- App::uses('AppModel', 'Model');
- /**
- * Moto Model
- *
- * @property Veiculo $Veiculo
- * @property MotoEstilo $MotoEstilo
- * @property RefrigeracaoTipo $RefrigeracaoTipo
- */
- class Moto extends AppModel {
- /**
- * Validation rules
- *
- * @var array
- */
- public $validate = array(
- 'veiculo_id' => array(
- 'numeric' => array(
- 'rule' => array('numeric'),
- //'message' => 'Your custom message here',
- //'allowEmpty' => false,
- //'required' => false,
- //'last' => false, // Stop validation after this rule
- //'on' => 'create', // Limit validation to 'create' or 'update' operations
- ),
- ),
- 'moto_estilo_id' => array(
- 'numeric' => array(
- 'rule' => array('numeric'),
- //'message' => 'Your custom message here',
- //'allowEmpty' => false,
- //'required' => false,
- //'last' => false, // Stop validation after this rule
- //'on' => 'create', // Limit validation to 'create' or 'update' operations
- ),
- ),
- 'refrigeracao_tipo_id' => array(
- 'numeric' => array(
- 'rule' => array('numeric'),
- //'message' => 'Your custom message here',
- //'allowEmpty' => false,
- //'required' => false,
- //'last' => false, // Stop validation after this rule
- //'on' => 'create', // Limit validation to 'create' or 'update' operations
- ),
- ),
- 'ativo' => array(
- 'boolean' => array(
- 'rule' => array('boolean'),
- //'message' => 'Your custom message here',
- //'allowEmpty' => false,
- //'required' => false,
- //'last' => false, // Stop validation after this rule
- //'on' => 'create', // Limit validation to 'create' or 'update' operations
- ),
- ),
- );
- //The Associations below have been created with all possible keys, those that are not needed can be removed
- /**
- * belongsTo associations
- *
- * @var array
- */
- public $belongsTo = array(
- 'Veiculo' => array(
- 'className' => 'Veiculo',
- 'foreignKey' => 'veiculo_id',
- 'conditions' => '',
- 'fields' => '',
- 'order' => ''
- ),
- 'MotoEstilo' => array(
- 'className' => 'MotoEstilo',
- 'foreignKey' => 'moto_estilo_id',
- 'conditions' => '',
- 'fields' => '',
- 'order' => ''
- ),
- 'RefrigeracaoTipo' => array(
- 'className' => 'RefrigeracaoTipo',
- 'foreignKey' => 'refrigeracao_tipo_id',
- 'conditions' => '',
- 'fields' => '',
- 'order' => ''
- )
- );
- public function getBuscaRapida(){
- $opcionais = $this->Veiculo->Opcional->findByModel('motos');
- return compact('opcionais');
- }
- }
Add Comment
Please, Sign In to add comment