<?php
App::uses('AppModel', 'Model');
class Vendor extends AppModel{
public $displayField = 'fullname';
public $order = 'Vendor.fullname ASC';
public $validate = array(
'fullname' => array(
'notBlank' => array(
'rule' => array('notBlank'),
'message' => 'Please enter fullname.'
)
),
'email' => array(
'notBlank' => array(
'rule' => array('notBlank'),
'message' => 'Please enter email.'
),
'email' => array(
'rule' => array('email'),
'message' => 'Please enter valid email.'
)
),
'phone' => array(
'notBlank' => array(
'rule' => array('notBlank'),
'message' => 'Please enter phone.'
)
)
);
public function beforeSave($options = array()) {
$this->data[$this->alias]['token'] = md5(date('Y-m-d H:i:s'));
// fallback to our parent
return parent::beforeSave($options);
}
public $hasMany = array(
'Applicant' => array(
'className' => 'Applicant',
'foreignKey' => 'vendor_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'AmountTransaction' => array(
'className' => 'AmountTransaction',
'foreignKey' => 'vendor_id',
'dependent' => false
),
'VendorApplicantFee' => array(
'className' => 'VendorApplicantFee',
'foreignKey' => 'vendor_id',
'dependent' => false
)
);
}