Skip to content

Instantly share code, notes, and snippets.

@cakephp-tutorial
Created February 27, 2016 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cakephp-tutorial/d0e9b86b34d50756bc46 to your computer and use it in GitHub Desktop.
Save cakephp-tutorial/d0e9b86b34d50756bc46 to your computer and use it in GitHub Desktop.
<?php
# /app/Model/Order.php
class Order extends AppModel {
public $hasAndBelongsToMany = array('Region');
public $validate = array(
'company' => array(
'rule' => array('notEmpty'),
'required' => true,
'message' => 'inserire un nome azienda'
),
'email' => array(
'rule' => 'email',
'required' => true,
'message' => 'inserire un indirizzo email valido'
),
'Region' => array(
'rule' => array('multiple', array('min' => 1)),
'required' => true,
'message' => 'selezionare almeno una regione'
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment