Files
pmgr/site/models/unit.php
abijah dbe037fee8 Added support for querying only occupied or vacant units. It's working at the moment, but I'll probably move some more logic to the controller next.
git-svn-id: file:///svn-source/pmgr/branches/initial_20090526@29 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-05-28 21:52:14 +00:00

53 lines
1.1 KiB
PHP

<?php
class Unit extends AppModel {
var $name = 'Unit';
var $validate = array(
'id' => array('numeric'),
'unit_size_id' => array('numeric'),
'name' => array('notempty'),
'sort_order' => array('numeric'),
'walk_order' => array('numeric'),
'deposit' => array('money'),
'amount' => array('money')
);
var $belongsTo = array(
'UnitSize' => array(
'className' => 'UnitSize',
'foreignKey' => 'unit_size_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
/* 'Map' => array( */
/* 'className' => 'MapsUnit', */
/* 'foreignKey' => 'unit_id', */
/* 'conditions' => '', */
/* 'fields' => '', */
/* 'order' => '' */
/* ) */
);
var $hasMany = array(
'Lease' => array(
'className' => 'Lease',
'foreignKey' => 'unit_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
function occupiedEnumValue() {
$enums = $this->getEnumValues('status');
return $enums['OCCUPIED'];
}
}