Example #1
0
 function __construct($name, $params, $dbObject)
 {
     parent::__construct($name, $params, $dbObject);
     if (isset($params['options'])) {
         if (isset($params['localField'])) {
             $this->localFieldName = $params['localField'];
         } else {
             $this->localFieldName = $name . '_id';
         }
         $this->options = $params['options'];
     } else {
         if (isset($params['local_field'])) {
             $this->localFieldName = $params['local_field'];
         } else {
             $this->localFieldName = $name . '_id';
         }
         if (isset($params['option_table'])) {
             $this->remoteTable = $params['option_table'];
         } else {
             $this->remoteTable = $name;
         }
         if (isset($params['option_key_field'])) {
             $this->remoteKeyField = $params['option_key_field'];
         } else {
             $this->remoteKeyField = 'id';
         }
         if (isset($params['option_value_field'])) {
             $this->remoteValueField = $params['option_value_field'];
         } else {
             $this->remoteValueField = 'name';
         }
     }
 }
 function __construct($name, $params, $dbObject)
 {
     parent::__construct($name, $params, $dbObject);
     if (isset($params['local_field'])) {
         $this->localField = $params['local_field'];
     } else {
         $this->localField = 'id';
     }
     if (isset($params['through'])) {
         $this->joinTable = $params['through'];
     } else {
         $this->joinTable = $name;
     }
     if (isset($params['join_table_local_field'])) {
         $this->joinTableLocalField = $params['join_table_local_field'];
     } else {
         $this->joinTableLocalField = $this->getTableName() . '_id';
     }
     if (isset($params['remote_class'])) {
         $this->remoteClass = $params['remote_class'];
     } else {
         $this->remoteClass = $name;
     }
     if (isset($params['join_table_remote_field'])) {
         $this->joinTableRemoteField = $params['join_table_remote_field'];
     } else {
         $this->joinTableRemoteField = DbObject::_getTableName($this->remoteClass) . '_id';
     }
     if (isset($params['remote_field'])) {
         $this->remoteField = $params['remote_field'];
     } else {
         $this->remoteField = 'id';
     }
 }
Example #3
0
 function __construct($name, $params, $dbObject)
 {
     parent::__construct($name, $params, $dbObject);
     if (isset($params['class'])) {
         $this->remoteClassName = $params['class'];
     } else {
         $this->remoteClassName = $name;
     }
     if (isset($params['remote_field'])) {
         $this->remoteFieldName = $params['remote_field'];
     } else {
         $this->remoteFieldName = $this->dbObject->getTableName() . '_id';
     }
     if (isset($params['local_field'])) {
         $this->localFieldName = $params['local_field'];
     } else {
         $this->localFieldName = 'id';
     }
 }
Example #4
0
 function __construct($name, $params, $dbObject)
 {
     parent::__construct($name, $params, $dbObject);
     if (isset($params['options'])) {
         if (isset($params['localField'])) {
             $this->localFieldName = $params['localField'];
         } else {
             $this->localFieldName = $name . '_id';
         }
         $this->options = $params['options'];
     } else {
         // for uniformity and backwards compatibility
         if (isset($params['local_field'])) {
             $params['localField'] = $params['local_field'];
         }
         if (isset($params['localField'])) {
             $this->localFieldName = $params['localField'];
         } else {
             $this->localFieldName = $name . '_id';
         }
         // for uniformity and backwards compatibility
         if (isset($params['option_table'])) {
             $params['optionTable'] = $params['option_table'];
         }
         if (isset($params['optionTable'])) {
             $this->remoteTable = $params['optionTable'];
         } else {
             $this->remoteTable = $name;
         }
         if (isset($params['option_key_field'])) {
             $this->remoteKeyField = $params['option_key_field'];
         } else {
             $this->remoteKeyField = 'id';
         }
         if (isset($params['option_value_field'])) {
             $this->remoteValueField = $params['option_value_field'];
         } else {
             $this->remoteValueField = 'name';
         }
     }
 }