<?php
App::uses('AppModel', 'Model');
class Bank extends AppModel
{
/**
* Display field
*
* @var string
*/
public $displayField = 'name';
/**
* Validation rules
*
* @var array
*/
public $order = 'Bank.name ASC';
public $validate = array(
'name' => array(
'unique' => array(
'rule' => array('isUnique'),
'message' => 'Bank name already exists'
),
'notBlank' => array(
'rule' => array('notBlank'),
'message' => 'Bank name cannot be empty',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'amount' => array(
'numeric' => array(
'rule' => array('numeric'),
'message' => 'Please enter number only.',
'allowEmpty' => true
)
),
);
// The Associations below have been created with all possible keys, those that are not needed can be removed
/**
* hasMany associations
*
* @var array
*/
public $hasMany = array(
'AmountTransaction' => array(
'className' => 'AmountTransaction',
'foreignKey' => 'bank_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Expenditure' => array(
'className' => 'Expenditure',
'foreignKey' => 'bank_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
}