<?php
/**
- * This class has been auto-generated by the IPF_ORM Framework
+ * This class has been auto-generated by the IPF_ORM Framework.
+ * Changes to this file may cause incorrect behavior
+ * and will be lost if the code is regenerated.
*/
+
abstract class BaseAdminLog extends IPF_ORM_Record
{
public function setTableDefinition()
$this->hasColumn('object_repr', 'string', 200, array('type' => 'string', 'length' => '200'));
$this->hasColumn('action_flag', 'integer', null, array('type' => 'integer'));
$this->hasColumn('change_message', 'string', 200, array('type' => 'string', 'length' => '200'));
-
-
$this->index('idx_object_id', array('fields' => 'object_id'));
$this->index('idx_object_class', array('fields' => 'object_class'));
$this->index('idx_created_at', array('fields' => 'created_at'));
$this->option('type', 'INNODB');
$this->option('collate', 'utf8_unicode_ci');
$this->option('charset', 'utf8');
+
}
public function setUp()
{
$timestampable0 = new IPF_ORM_Template_Timestampable(array('updated' => array('disabled' => true)));
- $this->actAs($timestampable0);
+ $this->getTable()->addTemplate($timestampable0);
+ }
+
+ public static function table()
+ {
+ return IPF_ORM::getTable('AdminLog');
+ }
+
+ public static function query($alias='')
+ {
+ return IPF_ORM::getTable('AdminLog')->createQuery($alias);
}
}
\ No newline at end of file
<?php
/**
- * This class has been auto-generated by the IPF_ORM Framework
+ * This class has been auto-generated by the IPF_ORM Framework.
+ * Changes to this file may cause incorrect behavior
+ * and will be lost if the code is regenerated.
*/
+
abstract class BasePermission extends IPF_ORM_Record
{
public function setTableDefinition()
{
$this->setTableName('auth_permission');
$this->hasColumn('name', 'string', 255, array('unique' => true, 'type' => 'string', 'length' => '255'));
-
$this->option('type', 'INNODB');
$this->option('collate', 'utf8_unicode_ci');
$this->option('charset', 'utf8');
+
}
public function setUp()
$this->hasMany('User as Users', array('refClass' => 'UserPermission',
'local' => 'permission_id',
'foreign' => 'user_id'));
+
$this->hasMany('Role as Roles', array('refClass' => 'RolePermission',
'local' => 'permission_id',
'foreign' => 'role_id'));
$this->hasMany('UserPermission', array('local' => 'id',
'foreign' => 'permission_id'));
}
-}
+
+ public static function table()
+ {
+ return IPF_ORM::getTable('Permission');
+ }
+
+ public static function query($alias='')
+ {
+ return IPF_ORM::getTable('Permission')->createQuery($alias);
+ }
+}
\ No newline at end of file
<?php
/**
- * This class has been auto-generated by the IPF_ORM Framework
+ * This class has been auto-generated by the IPF_ORM Framework.
+ * Changes to this file may cause incorrect behavior
+ * and will be lost if the code is regenerated.
*/
+
abstract class BaseRole extends IPF_ORM_Record
{
public function setTableDefinition()
{
$this->setTableName('auth_role');
- $this->hasColumn('name', 'string', 255, array('unique' => true, 'notblank' => true, 'type' => 'string', 'length' => '255'));
-
+ $this->hasColumn('name', 'string', 255, array('unique' => true, 'type' => 'string', 'notblank' => true, 'length' => '255'));
$this->option('type', 'INNODB');
$this->option('collate', 'utf8_unicode_ci');
$this->option('charset', 'utf8');
+
}
public function setUp()
{
- $this->hasMany('User as Users', array('refClass' => 'UserRole',
- 'local' => 'role_id',
- 'foreign' => 'user_id'));
$this->hasMany('Permission as Permissions', array('refClass' => 'RolePermission',
'local' => 'role_id',
'foreign' => 'permission_id'));
-
+
+ $this->hasMany('User as Users', array('refClass' => 'UserRole',
+ 'local' => 'role_id',
+ 'foreign' => 'user_id'));
$this->hasMany('RolePermission', array('local' => 'id',
'foreign' => 'role_id'));
$this->hasMany('UserRole', array('local' => 'id',
'foreign' => 'role_id'));
}
-}
+
+ public static function table()
+ {
+ return IPF_ORM::getTable('Role');
+ }
+
+ public static function query($alias='')
+ {
+ return IPF_ORM::getTable('Role')->createQuery($alias);
+ }
+}
\ No newline at end of file
<?php
/**
- * This class has been auto-generated by the IPF_ORM Framework
+ * This class has been auto-generated by the IPF_ORM Framework.
+ * Changes to this file may cause incorrect behavior
+ * and will be lost if the code is regenerated.
*/
+
abstract class BaseRolePermission extends IPF_ORM_Record
{
public function setTableDefinition()
$this->setTableName('auth_role_permission');
$this->hasColumn('role_id', 'integer', null, array('type' => 'integer', 'primary' => true));
$this->hasColumn('permission_id', 'integer', null, array('type' => 'integer', 'primary' => true));
-
$this->option('type', 'INNODB');
$this->option('collate', 'utf8_unicode_ci');
$this->option('charset', 'utf8');
+
}
public function setUp()
'foreign' => 'id',
'onDelete' => 'CASCADE'));
}
-}
+
+ public static function table()
+ {
+ return IPF_ORM::getTable('RolePermission');
+ }
+
+ public static function query($alias='')
+ {
+ return IPF_ORM::getTable('RolePermission')->createQuery($alias);
+ }
+}
\ No newline at end of file
<?php
/**
- * This class has been auto-generated by the IPF_ORM Framework
+ * This class has been auto-generated by the IPF_ORM Framework.
+ * Changes to this file may cause incorrect behavior
+ * and will be lost if the code is regenerated.
*/
+
abstract class BaseUser extends IPF_ORM_Record
{
public function setTableDefinition()
$this->hasColumn('is_active', 'boolean', null, array('type' => 'boolean', 'notnull' => true, 'default' => false));
$this->hasColumn('is_superuser', 'boolean', null, array('type' => 'boolean', 'notnull' => true, 'default' => false));
$this->hasColumn('last_login', 'timestamp', null, array('type' => 'timestamp'));
-
$this->option('type', 'INNODB');
$this->option('collate', 'utf8_unicode_ci');
$this->option('charset', 'utf8');
+
}
public function setUp()
'foreign' => 'user_id'));
$timestampable0 = new IPF_ORM_Template_Timestampable();
- $this->actAs($timestampable0);
+ $this->getTable()->addTemplate($timestampable0);
+ }
+
+ public static function table()
+ {
+ return IPF_ORM::getTable('User');
+ }
+
+ public static function query($alias='')
+ {
+ return IPF_ORM::getTable('User')->createQuery($alias);
}
}
\ No newline at end of file
<?php
/**
- * This class has been auto-generated by the IPF_ORM Framework
+ * This class has been auto-generated by the IPF_ORM Framework.
+ * Changes to this file may cause incorrect behavior
+ * and will be lost if the code is regenerated.
*/
+
abstract class BaseUserPermission extends IPF_ORM_Record
{
public function setTableDefinition()
$this->setTableName('auth_user_permission');
$this->hasColumn('user_id', 'integer', null, array('type' => 'integer', 'primary' => true));
$this->hasColumn('permission_id', 'integer', null, array('type' => 'integer', 'primary' => true));
-
$this->option('type', 'INNODB');
$this->option('collate', 'utf8_unicode_ci');
$this->option('charset', 'utf8');
+
}
public function setUp()
'foreign' => 'id',
'onDelete' => 'CASCADE'));
}
-}
+
+ public static function table()
+ {
+ return IPF_ORM::getTable('UserPermission');
+ }
+
+ public static function query($alias='')
+ {
+ return IPF_ORM::getTable('UserPermission')->createQuery($alias);
+ }
+}
\ No newline at end of file
<?php
/**
- * This class has been auto-generated by the IPF_ORM Framework
+ * This class has been auto-generated by the IPF_ORM Framework.
+ * Changes to this file may cause incorrect behavior
+ * and will be lost if the code is regenerated.
*/
+
abstract class BaseUserRole extends IPF_ORM_Record
{
public function setTableDefinition()
$this->setTableName('auth_user_role');
$this->hasColumn('user_id', 'integer', null, array('type' => 'integer', 'primary' => true));
$this->hasColumn('role_id', 'integer', null, array('type' => 'integer', 'primary' => true));
-
$this->option('type', 'INNODB');
$this->option('collate', 'utf8_unicode_ci');
$this->option('charset', 'utf8');
+
}
public function setUp()
'foreign' => 'id',
'onDelete' => 'CASCADE'));
}
-}
+
+ public static function table()
+ {
+ return IPF_ORM::getTable('UserRole');
+ }
+
+ public static function query($alias='')
+ {
+ return IPF_ORM::getTable('UserRole')->createQuery($alias);
+ }
+}
\ No newline at end of file
if (is_array($options) && !empty($options)) {
$optionsPhp = self::varExport($options);
- $build .= " \$this->loadTemplate('" . $name . "', " . $optionsPhp . ");" . PHP_EOL;
+ $build .= " \$this->getTable()->addTemplate('" . $name . "', " . $optionsPhp . ");" . PHP_EOL;
} else {
if (isset($templates[0])) {
- $build .= " \$this->loadTemplate('" . $options . "');" . PHP_EOL;
+ $build .= " \$this->getTable()->addTemplate('" . $options . "');" . PHP_EOL;
} else {
- $build .= " \$this->loadTemplate('" . $name . "');" . PHP_EOL;
+ $build .= " \$this->getTable()->addTemplate('" . $name . "');" . PHP_EOL;
}
}
}
private function emitActAs($level, $name)
{
- return " \$this->actAs(\$" . strtolower($name) . "$level);" . PHP_EOL;
+ return " \$this->getTable()->addTemplate(\$" . strtolower($name) . "$level);" . PHP_EOL;
}
private function buildActAs($actAs)
}
}
- public function loadTemplate($template, array $options = array())
- {
- $this->actAs($template, $options);
- }
-
public function bindQueryParts(array $queryParts)
{
$this->_table->bindQueryParts($queryParts);
$this->_table->addGenerator($generator, get_class($generator));
}
- public function actAs($tpl, array $options = array())
- {
- if ( ! is_object($tpl)) {
- $className = 'IPF_ORM_Template_' . $tpl;
-
- if (class_exists($className, true)) {
- $tpl = new $className($options);
- } else if (class_exists($tpl, true)) {
- $tpl = new $tpl($options);
- } else {
- throw new IPF_ORM_Record_Exception('Could not load behavior named: "' . $tpl . '"');
- }
- }
-
- if ( ! ($tpl instanceof IPF_ORM_Template)) {
- throw new IPF_ORM_Record_Exception('Loaded behavior class is not an istance of IPF_ORM_Template.');
- }
-
- $className = get_class($tpl);
-
- $this->_table->addTemplate($className, $tpl);
-
- $tpl->setTable($this->_table);
- $tpl->setUp();
- $tpl->setTableDefinition();
-
- return $this;
- }
-
public function check($constraint, $name = null)
{
if (is_array($constraint)) {
return isset($this->_templates[$template]);
}
- public function addTemplate($template, IPF_ORM_Template $impl)
+ public function addTemplate($tpl, array $options=array())
{
- $this->_templates[$template] = $impl;
+ if (!is_object($tpl)) {
+ $className = 'IPF_ORM_Template_' . $tpl;
- return $this;
+ if (class_exists($className, true)) {
+ $tpl = new $className($options);
+ } else if (class_exists($tpl, true)) {
+ $tpl = new $tpl($options);
+ } else {
+ throw new IPF_ORM_Record_Exception('Could not load behavior named: "' . $tpl . '"');
+ }
+ }
+
+ if (!($tpl instanceof IPF_ORM_Template)) {
+ throw new IPF_ORM_Record_Exception('Loaded behavior class is not an istance of IPF_ORM_Template.');
+ }
+
+ $className = get_class($tpl);
+ $this->_templates[$className] = $tpl;
+
+ $tpl->setTable($this);
+ $tpl->setUp();
+ $tpl->setTableDefinition();
}
public function getGenerators()
<?php
/**
- * This class has been auto-generated by the IPF_ORM Framework
+ * This class has been auto-generated by the IPF_ORM Framework.
+ * Changes to this file may cause incorrect behavior
+ * and will be lost if the code is regenerated.
*/
+
abstract class BaseSession extends IPF_ORM_Record
{
public function setTableDefinition()
$this->hasColumn('expire_data', 'timestamp', null, array('type' => 'timestamp'));
}
+
+
+ public static function table()
+ {
+ return IPF_ORM::getTable('Session');
+ }
+
+ public static function query($alias='')
+ {
+ return IPF_ORM::getTable('Session')->createQuery($alias);
+ }
}
\ No newline at end of file