<?php
class Group extends AppModel {
var $name = 'Group';
var $actsAs = array('Acl' => array('type' => 'requester'),'WhoDidIt');
function parentNode() {
return null;
}
var $validate = array(
'name' => array(
'notempty' => array(
'rule' => array('notempty'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
);
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'ParentGroup' => array(
'className' => 'Group',
'foreignKey' => 'parent_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'GroupType' => array(
'className' => 'GroupType',
'foreignKey' => 'group_type_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'Organisation' => array(
'className' => 'Organisation',
'foreignKey' => 'organisation_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'CreatedBy' => array(
'className' => 'User',
'foreignKey' => 'created_by',
'fields' => array('id','name')
),
'ModifiedBy' => array(
'className' => 'User',
'foreignKey' => 'modified_by',
'fields' => array('id','name')
)
);
var $hasMany = array(
'ChildGroup' => array(
'className' => 'Group',
'foreignKey' => 'parent_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Menu' => array(
'className' => 'Menu',
'foreignKey' => 'group_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'User' => array(
'className' => 'User',
'foreignKey' => 'group_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);
var $hasAndBelongsToMany = array(
'DetailType' => array(
'className' => 'DetailType',
'joinTable' => 'detail_types_groups',
'foreignKey' => 'group_id',
'associationForeignKey' => 'detail_type_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);
}
?>