Added phone and address models as well as outputing them to the view.
git-svn-id: file:///svn-source/pmgr/branches/initial_20090526@16 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -25,6 +25,36 @@ class Contact extends AppModel {
|
||||
'deleteQuery' => '',
|
||||
'insertQuery' => ''
|
||||
),
|
||||
'ContactAddress' => array(
|
||||
'className' => 'ContactAddress',
|
||||
'joinTable' => 'contacts_methods',
|
||||
'foreignKey' => 'contact_id',
|
||||
'associationForeignKey' => 'method_id',
|
||||
'unique' => true,
|
||||
'conditions' => "ContactsMethod.method = 'POST'",
|
||||
'fields' => '',
|
||||
'order' => '',
|
||||
'limit' => '',
|
||||
'offset' => '',
|
||||
'finderQuery' => '',
|
||||
'deleteQuery' => '',
|
||||
'insertQuery' => ''
|
||||
),
|
||||
'ContactPhone' => array(
|
||||
'className' => 'ContactPhone',
|
||||
'joinTable' => 'contacts_methods',
|
||||
'foreignKey' => 'contact_id',
|
||||
'associationForeignKey' => 'method_id',
|
||||
'unique' => true,
|
||||
'conditions' => "ContactsMethod.method = 'PHONE'",
|
||||
'fields' => '',
|
||||
'order' => '',
|
||||
'limit' => '',
|
||||
'offset' => '',
|
||||
'finderQuery' => '',
|
||||
'deleteQuery' => '',
|
||||
'insertQuery' => ''
|
||||
),
|
||||
'ContactEmail' => array(
|
||||
'className' => 'ContactEmail',
|
||||
'joinTable' => 'contacts_methods',
|
||||
@@ -39,7 +69,7 @@ class Contact extends AppModel {
|
||||
'finderQuery' => '',
|
||||
'deleteQuery' => '',
|
||||
'insertQuery' => ''
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
28
site/models/contact_address.php
Normal file
28
site/models/contact_address.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
class ContactAddress extends AppModel {
|
||||
|
||||
var $name = 'ContactAddress';
|
||||
var $validate = array(
|
||||
'id' => array('numeric'),
|
||||
'postcode' => array('postal')
|
||||
);
|
||||
|
||||
var $hasAndBelongsToMany = array(
|
||||
'Contact' => array(
|
||||
'className' => 'Contact',
|
||||
'joinTable' => 'contacts_methods',
|
||||
'foreignKey' => 'method_id',
|
||||
'associationForeignKey' => 'contact_id',
|
||||
'unique' => true,
|
||||
'conditions' => "ContactsMethod.method = 'POST'",
|
||||
'fields' => '',
|
||||
'order' => '',
|
||||
'limit' => '',
|
||||
'offset' => '',
|
||||
'finderQuery' => '',
|
||||
'deleteQuery' => '',
|
||||
'insertQuery' => ''
|
||||
)
|
||||
);
|
||||
}
|
||||
?>
|
||||
@@ -7,7 +7,6 @@ class ContactEmail extends AppModel {
|
||||
'email' => array('email')
|
||||
);
|
||||
|
||||
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||
var $hasAndBelongsToMany = array(
|
||||
'Contact' => array(
|
||||
'className' => 'Contact',
|
||||
|
||||
31
site/models/contact_phone.php
Normal file
31
site/models/contact_phone.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
class ContactPhone extends AppModel {
|
||||
|
||||
var $name = 'ContactPhone';
|
||||
var $validate = array(
|
||||
'id' => array('numeric'),
|
||||
//'type' => array('inlist'),
|
||||
'phone' => array('phone'),
|
||||
'ext' => array('numeric')
|
||||
);
|
||||
|
||||
var $hasAndBelongsToMany = array(
|
||||
'Contact' => array(
|
||||
'className' => 'Contact',
|
||||
'joinTable' => 'contacts_methods',
|
||||
'foreignKey' => 'method_id',
|
||||
'associationForeignKey' => 'contact_id',
|
||||
'unique' => true,
|
||||
'conditions' => "ContactsMethod.method = 'PHONE'",
|
||||
'fields' => '',
|
||||
'order' => '',
|
||||
'limit' => '',
|
||||
'offset' => '',
|
||||
'finderQuery' => '',
|
||||
'deleteQuery' => '',
|
||||
'insertQuery' => ''
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user