Guest User

Untitled

a guest
Sep 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. <?php
  2. App::uses('AppModel', 'Model');
  3. /**
  4. * Moto Model
  5. *
  6. * @property Veiculo $Veiculo
  7. * @property MotoEstilo $MotoEstilo
  8. * @property RefrigeracaoTipo $RefrigeracaoTipo
  9. */
  10. class Moto extends AppModel {
  11. /**
  12. * Validation rules
  13. *
  14. * @var array
  15. */
  16. public $validate = array(
  17. 'veiculo_id' => array(
  18. 'numeric' => array(
  19. 'rule' => array('numeric'),
  20. //'message' => 'Your custom message here',
  21. //'allowEmpty' => false,
  22. //'required' => false,
  23. //'last' => false, // Stop validation after this rule
  24. //'on' => 'create', // Limit validation to 'create' or 'update' operations
  25. ),
  26. ),
  27. 'moto_estilo_id' => array(
  28. 'numeric' => array(
  29. 'rule' => array('numeric'),
  30. //'message' => 'Your custom message here',
  31. //'allowEmpty' => false,
  32. //'required' => false,
  33. //'last' => false, // Stop validation after this rule
  34. //'on' => 'create', // Limit validation to 'create' or 'update' operations
  35. ),
  36. ),
  37. 'refrigeracao_tipo_id' => array(
  38. 'numeric' => array(
  39. 'rule' => array('numeric'),
  40. //'message' => 'Your custom message here',
  41. //'allowEmpty' => false,
  42. //'required' => false,
  43. //'last' => false, // Stop validation after this rule
  44. //'on' => 'create', // Limit validation to 'create' or 'update' operations
  45. ),
  46. ),
  47. 'ativo' => array(
  48. 'boolean' => array(
  49. 'rule' => array('boolean'),
  50. //'message' => 'Your custom message here',
  51. //'allowEmpty' => false,
  52. //'required' => false,
  53. //'last' => false, // Stop validation after this rule
  54. //'on' => 'create', // Limit validation to 'create' or 'update' operations
  55. ),
  56. ),
  57. );
  58.  
  59. //The Associations below have been created with all possible keys, those that are not needed can be removed
  60.  
  61. /**
  62. * belongsTo associations
  63. *
  64. * @var array
  65. */
  66. public $belongsTo = array(
  67. 'Veiculo' => array(
  68. 'className' => 'Veiculo',
  69. 'foreignKey' => 'veiculo_id',
  70. 'conditions' => '',
  71. 'fields' => '',
  72. 'order' => ''
  73. ),
  74. 'MotoEstilo' => array(
  75. 'className' => 'MotoEstilo',
  76. 'foreignKey' => 'moto_estilo_id',
  77. 'conditions' => '',
  78. 'fields' => '',
  79. 'order' => ''
  80. ),
  81. 'RefrigeracaoTipo' => array(
  82. 'className' => 'RefrigeracaoTipo',
  83. 'foreignKey' => 'refrigeracao_tipo_id',
  84. 'conditions' => '',
  85. 'fields' => '',
  86. 'order' => ''
  87. )
  88. );
  89.  
  90. public function getBuscaRapida(){
  91.  
  92. $opcionais = $this->Veiculo->Opcional->findByModel('motos');
  93.  
  94.  
  95. return compact('opcionais');
  96. }
  97. }
Add Comment
Please, Sign In to add comment