protected $_name;
protected $driverName;
protected $isConnected = false;
- protected $supported = array();
protected $pendingAttributes = array();
private $modules = array('transaction' => false,
'varchar_max_length' => 255,
);
- protected $serverInfo = array();
protected $options = array();
private static $availableDrivers = array(
'Mysql',
$this->_tables = null;
}
- protected function _getClassnameToReturn(array &$data, $component)
+ protected function _getClassNameToReturn(array &$data, $component)
{
if ( ! isset($this->_tables[$component])) {
$this->_tables[$component] = IPF_ORM::getTable($component);
public function getTemplates()
{
return $this->_templates;
-
}
public function getExportableFormat($parseForeignKeys = true)
return $record;
}
- public function getClassnameToReturn()
- {
- if ( ! isset($this->_options['subclasses'])) {
- return $this->_options['name'];
- }
- foreach ($this->_options['subclasses'] as $subclass) {
- $table = $this->_conn->getTable($subclass);
- $inheritanceMap = $table->getOption('inheritanceMap');
- $nomatch = false;
- foreach ($inheritanceMap as $key => $value) {
- if ( ! isset($this->_data[$key]) || $this->_data[$key] != $value) {
- $nomatch = true;
- break;
- }
- }
- if ( ! $nomatch) {
- return $table->getComponentName();
- }
- }
- return $this->_options['name'];
- }
-
final public function getProxy($id = null)
{
if ($id !== null) {
public function getTemplate($template)
{
- if ( ! isset($this->_templates[$template])) {
+ if (!isset($this->_templates[$template]))
throw new IPF_ORM_Exception('Template ' . $template . ' not loaded');
- }
-
return $this->_templates[$template];
}
$r[] = "</pre>";
return implode("\n",$r);
}
-
- static function setOrd($obj, $field_name='ord', $where=null, $params=null){
- $res = null;
- if ($where){
- $res = IPF_ORM_Query::create()
- ->select("max($field_name) as max_ord")
- ->from($obj->getTable()->getClassnameToReturn())
- ->where($where, $params)
- ->execute();
- }
- else{
- $res = IPF_ORM_Query::create()
- ->select("max($field_name) as max_ord")
- ->from($obj->getTable()->getClassnameToReturn())
- ->execute();
- }
- if (isset($res[0]['max_ord']))
- $obj->$field_name = (int)$res[0]->max_ord + 1;
- else
- $obj->$field_name = 1;
- }
}