Added phone and address models as well as outputing them to the view.

git-svn-id: file:///svn-source/pmgr/branches/initial_20090526/site@16 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-05-28 06:31:07 +00:00
parent 47af64aefe
commit 47d362750e
5 changed files with 194 additions and 12 deletions

View File

@@ -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' => ''
)
),
);
}

View 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' => ''
)
);
}
?>

View File

@@ -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
models/contact_phone.php Normal file
View 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' => ''
)
);
}
?>