Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
#/app/Model/Book.php
class Book extends AppModel {
public $name = 'Book';
public $displayField ='title';
public $belongsTo = array('Author');
public $validate = array(
          'title' => array(
'rule' => array('notEmpty'),
             'required' => true,
             'allowEmpty' => false,
             'message' => 'Inserire il titolo del libro'
          ),
'description' => array(
'rule' => array('minLength', 30),
'required' => true,
'allowEmpty' =>false,
'message' => 'Descrizione obbligatoria.Lunghezza minima 30 caratteri.'
),
'isbn' => array(
'required' => true,
'allowEmpty' => false,
'rule' => array('rule' => array('minLength', 13)),
'message' => 'Codice Isbn non corretto ',
'unique' => array(
'rule' => 'isUnique',
'message' => 'Isbn già presente'
)
),
       );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment