Author: peter
Date: Tue Sep 15 11:35:41 2009
New Revision: 3309
Log:
add Status object to data model
Added:
trunk/lib/model/QubitStatus.php (contents, props changed)
trunk/lib/model/map/StatusMapBuilder.php (contents, props changed)
trunk/lib/model/om/BaseStatus.php (contents, props changed)
Modified:
trunk/config/schema.yml
trunk/data/fixtures/taxonomyTerms.yml
trunk/data/sql/lib.model.schema.sql
trunk/lib/model/QubitTaxonomy.php
trunk/lib/model/QubitTerm.php
trunk/lib/model/om/BaseObject.php
trunk/lib/model/om/BaseTerm.php
Modified: trunk/config/schema.yml
==============================================================================
--- trunk/config/schema.yml Tue Sep 15 11:12:45 2009 (r3308)
+++ trunk/config/schema.yml Tue Sep 15 11:35:41 2009 (r3309)
@@ -352,6 +352,13 @@
title: varchar(255)
content: longvarchar
+ status:
+ object_id: { type: integer, required: true, foreignTable: object,
foreignReference: id, onDelete: cascade }
+ type_id: { type: integer, foreignTable: term, foreignReference: id,
onDelete: cascade }
+ status_id: { type: integer, foreignTable: term, foreignReference: id,
onDelete: cascade }
+ created_at:
+ updated_at:
+
system_event:
type_id: { type: integer, foreignTable: term, foreignReference: id }
object_class: varchar(255)
Modified: trunk/data/fixtures/taxonomyTerms.yml
==============================================================================
--- trunk/data/fixtures/taxonomyTerms.yml Tue Sep 15 11:12:45 2009
(r3308)
+++ trunk/data/fixtures/taxonomyTerms.yml Tue Sep 15 11:35:41 2009
(r3309)
@@ -277,6 +277,16 @@
en: 'Term Relation Types'
QubitTaxonomy_root:
id: <?php echo QubitTaxonomy::ROOT_ID."\n" ?>
+ QubitTaxonomy_status_types:
+ source_culture: en
+ id: <?php echo QubitTaxonomy::STATUS_TYPE_ID."\n" ?>
+ name:
+ en: 'Status Types'
+ QubitTaxonomy_publication_status:
+ source_culture: en
+ id: <?php echo QubitTaxonomy::PUBLICATION_STATUS_ID."\n" ?>
+ name:
+ en: 'Publication Status'
QubitTerm:
QubitTerm_110:
taxonomy_id: <?php echo QubitTaxonomy::ROOT_ID."\n" ?>
@@ -805,6 +815,27 @@
source_culture: en
name:
en: associative
+ QubitTerm_status_type_publication:
+ taxonomy_id: QubitTaxonomy_status_types
+ parent_id: QubitTerm_110
+ id: <?php echo QubitTerm::STATUS_TYPE_PUBLICATION_ID."\n" ?>
+ source_culture: en
+ name:
+ en: publication
+ QubitTerm_publication_status_draft:
+ taxonomy_id: QubitTaxonomy_publication_status
+ parent_id: QubitTerm_110
+ id: <?php echo QubitTerm::PUBLICATION_STATUS_DRAFT_ID."\n" ?>
+ source_culture: en
+ name:
+ en: draft
+ QubitTerm_publication_status_published:
+ taxonomy_id: QubitTaxonomy_publication_status
+ parent_id: QubitTerm_110
+ id: <?php echo QubitTerm::PUBLICATION_STATUS_PUBLISHED_ID."\n" ?>
+ source_culture: en
+ name:
+ en: published
QubitTerm_146:
taxonomy_id: QubitTaxonomy_10
parent_id: QubitTerm_110
Modified: trunk/data/sql/lib.model.schema.sql
==============================================================================
--- trunk/data/sql/lib.model.schema.sql Tue Sep 15 11:12:45 2009 (r3308)
+++ trunk/data/sql/lib.model.schema.sql Tue Sep 15 11:35:41 2009 (r3309)
@@ -1256,6 +1256,39 @@
)Type=InnoDB;
#-----------------------------------------------------------------------------
+#-- q_status
+#-----------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `q_status`;
+
+
+CREATE TABLE `q_status`
+(
+ `object_id` INTEGER NOT NULL,
+ `type_id` INTEGER,
+ `status_id` INTEGER,
+ `created_at` DATETIME NOT NULL,
+ `updated_at` DATETIME NOT NULL,
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ INDEX `q_status_FI_1` (`object_id`),
+ CONSTRAINT `q_status_FK_1`
+ FOREIGN KEY (`object_id`)
+ REFERENCES `q_object` (`id`)
+ ON DELETE CASCADE,
+ INDEX `q_status_FI_2` (`type_id`),
+ CONSTRAINT `q_status_FK_2`
+ FOREIGN KEY (`type_id`)
+ REFERENCES `q_term` (`id`)
+ ON DELETE CASCADE,
+ INDEX `q_status_FI_3` (`status_id`),
+ CONSTRAINT `q_status_FK_3`
+ FOREIGN KEY (`status_id`)
+ REFERENCES `q_term` (`id`)
+ ON DELETE CASCADE
+)Type=InnoDB;
+
+#-----------------------------------------------------------------------------
#-- q_system_event
#-----------------------------------------------------------------------------
Added: trunk/lib/model/QubitStatus.php
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/lib/model/QubitStatus.php Tue Sep 15 11:35:41 2009 (r3309)
@@ -0,0 +1,22 @@
+<?php
+
+/*
+ * This file is part of Qubit Toolkit.
+ *
+ * Qubit Toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Qubit Toolkit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Qubit Toolkit. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+class QubitStatus extends BaseStatus
+{
+}
Modified: trunk/lib/model/QubitTaxonomy.php
==============================================================================
--- trunk/lib/model/QubitTaxonomy.php Tue Sep 15 11:12:45 2009 (r3308)
+++ trunk/lib/model/QubitTaxonomy.php Tue Sep 15 11:35:41 2009 (r3309)
@@ -47,6 +47,8 @@
const RELATION_NOTE_TYPE_ID = 26;
const TERM_RELATION_TYPE_ID = 27;
const ROOT_ID = 28;
+ const STATUS_TYPE_ID = 29;
+ const PUBLICATION_STATUS_ID = 30;
public static $lockedTaxonomies = array(
self::QUBIT_SETTING_LABEL_ID,
@@ -56,7 +58,9 @@
self::RELATION_TYPE_ID,
self::RELATION_NOTE_TYPE_ID,
self::TERM_RELATION_TYPE_ID,
- self::ROOT_ID
+ self::ROOT_ID,
+ self::STATUS_TYPE_ID,
+ self::PUBLICATION_STATUS_ID
);
public function __toString()
Modified: trunk/lib/model/QubitTerm.php
==============================================================================
--- trunk/lib/model/QubitTerm.php Tue Sep 15 11:12:45 2009 (r3308)
+++ trunk/lib/model/QubitTerm.php Tue Sep 15 11:35:41 2009 (r3309)
@@ -92,6 +92,11 @@
// Term relation taxonomy
const TERM_RELATION_EQUIVALENCE_ID = 156;
const TERM_RELATION_ASSOCIATIVE_ID = 157;
+ // Status types taxonomy
+ const STATUS_TYPE_PUBLICATION_ID = 158;
+ // Publication status taxonomy
+ const PUBLICATION_STATUS_DRAFT_ID = 159;
+ const PUBLICATION_STATUS_PUBLISHED_ID = 160;
public function isProtected()
{
@@ -141,10 +146,12 @@
$this->getId() == QubitTerm::RELATION_NOTE_DESCRIPTION_ID ||
$this->getId() == QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID ||
$this->getId() == QubitTerm::TERM_RELATION_EQUIVALENCE_ID ||
- $this->getId() == QubitTerm::TERM_RELATION_ASSOCIATIVE_ID;
+ $this->getId() == QubitTerm::TERM_RELATION_ASSOCIATIVE_ID ||
+ $this->getId() == QubitTerm::STATUS_TYPE_PUBLICATION_ID ||
+ $this->getId() == QubitTerm::PUBLICATION_STATUS_DRAFT_ID ||
+ $this->getId() == QubitTerm::PUBLICATION_STATUS_PUBLISHED_ID;
}
-
public function __toString()
{
if (!$this->getName())
Added: trunk/lib/model/map/StatusMapBuilder.php
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/lib/model/map/StatusMapBuilder.php Tue Sep 15 11:35:41 2009
(r3309)
@@ -0,0 +1,49 @@
+<?php
+
+
+
+class StatusMapBuilder implements MapBuilder {
+
+
+ const CLASS_NAME = 'lib.model.map.StatusMapBuilder';
+
+
+ private $dbMap;
+
+
+ public function isBuilt()
+ {
+ return ($this->dbMap !== null);
+ }
+
+
+ public function getDatabaseMap()
+ {
+ return $this->dbMap;
+ }
+
+
+ public function doBuild()
+ {
+ $this->dbMap =
Propel::getDatabaseMap(QubitStatus::DATABASE_NAME);
+
+ $tMap = $this->dbMap->addTable(QubitStatus::TABLE_NAME);
+ $tMap->setPhpName('status');
+ $tMap->setClassname('QubitStatus');
+
+ $tMap->setUseIdGenerator(true);
+
+ $tMap->addForeignKey('OBJECT_ID', 'objectId', 'INTEGER',
'q_object', 'ID', true, null);
+
+ $tMap->addForeignKey('TYPE_ID', 'typeId', 'INTEGER', 'q_term',
'ID', false, null);
+
+ $tMap->addForeignKey('STATUS_ID', 'statusId', 'INTEGER',
'q_term', 'ID', false, null);
+
+ $tMap->addColumn('CREATED_AT', 'createdAt', 'TIMESTAMP', true,
null);
+
+ $tMap->addColumn('UPDATED_AT', 'updatedAt', 'TIMESTAMP', true,
null);
+
+ $tMap->addPrimaryKey('ID', 'id', 'INTEGER', true, null);
+
+ }
+}
\ No newline at end of file
Modified: trunk/lib/model/om/BaseObject.php
==============================================================================
--- trunk/lib/model/om/BaseObject.php Tue Sep 15 11:12:45 2009 (r3308)
+++ trunk/lib/model/om/BaseObject.php Tue Sep 15 11:35:41 2009 (r3309)
@@ -185,6 +185,11 @@
return true;
}
+ if ('statuss' == $name)
+ {
+ return true;
+ }
+
throw new sfException;
}
@@ -345,6 +350,23 @@
return $this->refFkValues['relationsRelatedByobjectId'];
}
+ if ('statuss' == $name)
+ {
+ if (!isset($this->refFkValues['statuss']))
+ {
+ if (!isset($this->id))
+ {
+ $this->refFkValues['statuss'] = QubitQuery::create();
+ }
+ else
+ {
+ $this->refFkValues['statuss'] = self::getstatussById($this->id,
array('self' => $this) + $options);
+ }
+ }
+
+ return $this->refFkValues['statuss'];
+ }
+
throw new sfException;
}
@@ -757,6 +779,26 @@
return self::addrelationsRelatedByobjectIdCriteriaById($criteria,
$this->id);
}
+ public static function addstatussCriteriaById(Criteria $criteria, $id)
+ {
+ $criteria->add(QubitStatus::OBJECT_ID, $id);
+
+ return $criteria;
+ }
+
+ public static function getstatussById($id, array $options = array())
+ {
+ $criteria = new Criteria;
+ self::addstatussCriteriaById($criteria, $id);
+
+ return QubitStatus::get($criteria, $options);
+ }
+
+ public function addstatussCriteria(Criteria $criteria)
+ {
+ return self::addstatussCriteriaById($criteria, $this->id);
+ }
+
public function __call($name, $args)
{
if ('get' == substr($name, 0, 3) || 'set' == substr($name, 0, 3))
Added: trunk/lib/model/om/BaseStatus.php
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/lib/model/om/BaseStatus.php Tue Sep 15 11:35:41 2009 (r3309)
@@ -0,0 +1,504 @@
+<?php
+
+abstract class BaseStatus implements ArrayAccess
+{
+ const
+ DATABASE_NAME = 'propel',
+
+ TABLE_NAME = 'q_status',
+
+ OBJECT_ID = 'q_status.OBJECT_ID',
+ TYPE_ID = 'q_status.TYPE_ID',
+ STATUS_ID = 'q_status.STATUS_ID',
+ CREATED_AT = 'q_status.CREATED_AT',
+ UPDATED_AT = 'q_status.UPDATED_AT',
+ ID = 'q_status.ID';
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+ $criteria->addSelectColumn(QubitStatus::OBJECT_ID);
+ $criteria->addSelectColumn(QubitStatus::TYPE_ID);
+ $criteria->addSelectColumn(QubitStatus::STATUS_ID);
+ $criteria->addSelectColumn(QubitStatus::CREATED_AT);
+ $criteria->addSelectColumn(QubitStatus::UPDATED_AT);
+ $criteria->addSelectColumn(QubitStatus::ID);
+
+ return $criteria;
+ }
+
+ protected static
+ $statuss = array();
+
+ protected
+ $row = array();
+
+ public static function getFromRow(array $row)
+ {
+ if (!isset(self::$statuss[$id = (int) $row[5]]))
+ {
+ $status = new QubitStatus;
+ $status->new = false;
+ $status->row = $row;
+
+ self::$statuss[$id] = $status;
+ }
+
+ return self::$statuss[$id];
+ }
+
+ public static function get(Criteria $criteria, array $options = array())
+ {
+ if (!isset($options['connection']))
+ {
+ $options['connection'] =
Propel::getConnection(QubitStatus::DATABASE_NAME);
+ }
+
+ self::addSelectColumns($criteria);
+
+ return QubitQuery::createFromCriteria($criteria, 'QubitStatus', $options);
+ }
+
+ public static function getAll(array $options = array())
+ {
+ return self::get(new Criteria, $options);
+ }
+
+ public static function getOne(Criteria $criteria, array $options = array())
+ {
+ $criteria->setLimit(1);
+
+ return self::get($criteria, $options)->__get(0, array('defaultValue' =>
null));
+ }
+
+ public static function getById($id, array $options = array())
+ {
+ $criteria = new Criteria;
+ $criteria->add(QubitStatus::ID, $id);
+
+ if (1 == count($query = self::get($criteria, $options)))
+ {
+ return $query[0];
+ }
+ }
+
+ public static function doDelete(Criteria $criteria, $connection = null)
+ {
+ if (!isset($connection))
+ {
+ $connection =
QubitTransactionFilter::getConnection(QubitStatus::DATABASE_NAME);
+ }
+
+ $affectedRows = 0;
+
+ $affectedRows += BasePeer::doDelete($criteria, $connection);
+
+ return $affectedRows;
+ }
+
+ protected
+ $tables = array();
+
+ public function __construct()
+ {
+ $this->tables[] =
Propel::getDatabaseMap(QubitStatus::DATABASE_NAME)->getTable(QubitStatus::TABLE_NAME);
+ }
+
+ protected
+ $values = array(),
+ $refFkValues = array();
+
+ protected function rowOffsetGet($name, $offset, $options)
+ {
+ if (empty($options['clean']) && array_key_exists($name, $this->values))
+ {
+ return $this->values[$name];
+ }
+
+ if (!array_key_exists($offset, $this->row))
+ {
+ if ($this->new)
+ {
+ return;
+ }
+
+ $this->refresh();
+ }
+
+ return $this->row[$offset];
+ }
+
+ public function __isset($name)
+ {
+ $args = func_get_args();
+
+ $options = array();
+ if (1 < count($args))
+ {
+ $options = $args[1];
+ }
+
+ $offset = 0;
+ foreach ($this->tables as $table)
+ {
+ foreach ($table->getColumns() as $column)
+ {
+ if ($name == $column->getPhpName())
+ {
+ return null !== $this->rowOffsetGet($name, $offset, $options);
+ }
+
+ if ($name.'Id' == $column->getPhpName())
+ {
+ return null !== $this->rowOffsetGet($name.'Id', $offset, $options);
+ }
+
+ $offset++;
+ }
+ }
+
+ throw new sfException;
+ }
+
+ public function offsetExists($offset)
+ {
+ $args = func_get_args();
+
+ return call_user_func_array(array($this, '__isset'), $args);
+ }
+
+ public function __get($name)
+ {
+ $args = func_get_args();
+
+ $options = array();
+ if (1 < count($args))
+ {
+ $options = $args[1];
+ }
+
+ $offset = 0;
+ foreach ($this->tables as $table)
+ {
+ foreach ($table->getColumns() as $column)
+ {
+ if ($name == $column->getPhpName())
+ {
+ return $this->rowOffsetGet($name, $offset, $options);
+ }
+
+ if ($name.'Id' == $column->getPhpName())
+ {
+ $relatedTable =
$column->getTable()->getDatabaseMap()->getTable($column->getRelatedTableName());
+
+ return call_user_func(array($relatedTable->getClassName(),
'getBy'.ucfirst($relatedTable->getColumn($column->getRelatedColumnName())->getPhpName())),
$this->rowOffsetGet($name.'Id', $offset, $options));
+ }
+
+ $offset++;
+ }
+ }
+
+ throw new sfException;
+ }
+
+ public function offsetGet($offset)
+ {
+ $args = func_get_args();
+
+ return call_user_func_array(array($this, '__get'), $args);
+ }
+
+ public function __set($name, $value)
+ {
+ $args = func_get_args();
+
+ $options = array();
+ if (2 < count($args))
+ {
+ $options = $args[2];
+ }
+
+ $offset = 0;
+ foreach ($this->tables as $table)
+ {
+ foreach ($table->getColumns() as $column)
+ {
+ if ($name == $column->getPhpName())
+ {
+ $this->values[$name] = $value;
+ }
+
+ if ($name.'Id' == $column->getPhpName())
+ {
+ $relatedTable =
$column->getTable()->getDatabaseMap()->getTable($column->getRelatedTableName());
+
+ $this->values[$name.'Id'] =
$value->__get($relatedTable->getColumn($column->getRelatedColumnName())->getPhpName(),
$options);
+ }
+
+ $offset++;
+ }
+ }
+
+ return $this;
+ }
+
+ public function offsetSet($offset, $value)
+ {
+ $args = func_get_args();
+
+ return call_user_func_array(array($this, '__set'), $args);
+ }
+
+ public function __unset($name)
+ {
+ $offset = 0;
+ foreach ($this->tables as $table)
+ {
+ foreach ($table->getColumns() as $column)
+ {
+ if ($name == $column->getPhpName())
+ {
+ $this->values[$name] = null;
+ }
+
+ if ($name.'Id' == $column->getPhpName())
+ {
+ $this->values[$name.'Id'] = null;
+ }
+
+ $offset++;
+ }
+ }
+
+ return $this;
+ }
+
+ public function offsetUnset($offset)
+ {
+ $args = func_get_args();
+
+ return call_user_func_array(array($this, '__unset'), $args);
+ }
+
+ protected
+ $new = true;
+
+ protected
+ $deleted = false;
+
+ public function refresh(array $options = array())
+ {
+ if (!isset($options['connection']))
+ {
+ $options['connection'] =
Propel::getConnection(QubitStatus::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria;
+ $criteria->add(QubitStatus::ID, $this->id);
+
+ call_user_func(array(get_class($this), 'addSelectColumns'), $criteria);
+
+ $statement = BasePeer::doSelect($criteria, $options['connection']);
+ $this->row = $statement->fetch();
+
+ return $this;
+ }
+
+ public function save($connection = null)
+ {
+ if ($this->deleted)
+ {
+ throw new PropelException('You cannot save an object that has been
deleted.');
+ }
+
+ $affectedRows = 0;
+
+ if ($this->new)
+ {
+ $affectedRows += $this->insert($connection);
+ }
+ else
+ {
+ $affectedRows += $this->update($connection);
+ }
+
+ $offset = 0;
+ foreach ($this->tables as $table)
+ {
+ foreach ($table->getColumns() as $column)
+ {
+ if (array_key_exists($column->getPhpName(), $this->values))
+ {
+ $this->row[$offset] = $this->values[$column->getPhpName()];
+ }
+
+ $offset++;
+ }
+ }
+
+ $this->new = false;
+ $this->values = array();
+
+ return $affectedRows;
+ }
+
+ protected function insert($connection = null)
+ {
+ $affectedRows = 0;
+
+ if (!isset($connection))
+ {
+ $connection =
QubitTransactionFilter::getConnection(QubitStatus::DATABASE_NAME);
+ }
+
+ $offset = 0;
+ foreach ($this->tables as $table)
+ {
+ $criteria = new Criteria;
+ foreach ($table->getColumns() as $column)
+ {
+ if (!array_key_exists($column->getPhpName(), $this->values))
+ {
+ if ('createdAt' == $column->getPhpName() || 'updatedAt' ==
$column->getPhpName())
+ {
+ $this->values[$column->getPhpName()] = new DateTime;
+ }
+
+ if ('sourceCulture' == $column->getPhpName())
+ {
+ $this->values['sourceCulture'] = sfPropel::getDefaultCulture();
+ }
+ }
+
+ if (array_key_exists($column->getPhpName(), $this->values))
+ {
+ $criteria->add($column->getFullyQualifiedName(),
$this->values[$column->getPhpName()]);
+ }
+
+ $offset++;
+ }
+
+ if (null !== $id = BasePeer::doInsert($criteria, $connection))
+ {
+ if ($this->tables[0] == $table)
+ {
+ $columns = $table->getPrimaryKeyColumns();
+ $this->values[$columns[0]->getPhpName()] = $id;
+ }
+ }
+
+ $affectedRows += 1;
+ }
+
+ return $affectedRows;
+ }
+
+ protected function update($connection = null)
+ {
+ $affectedRows = 0;
+
+ if (!isset($connection))
+ {
+ $connection =
QubitTransactionFilter::getConnection(QubitStatus::DATABASE_NAME);
+ }
+
+ $offset = 0;
+ foreach ($this->tables as $table)
+ {
+ $criteria = new Criteria;
+ $selectCriteria = new Criteria;
+ foreach ($table->getColumns() as $column)
+ {
+ if (!array_key_exists($column->getPhpName(), $this->values))
+ {
+ if ('updatedAt' == $column->getPhpName())
+ {
+ $this->values['updatedAt'] = new DateTime;
+ }
+ }
+
+ if (array_key_exists($column->getPhpName(), $this->values))
+ {
+ $criteria->add($column->getFullyQualifiedName(),
$this->values[$column->getPhpName()]);
+ }
+
+ if ($column->isPrimaryKey())
+ {
+ $selectCriteria->add($column->getFullyQualifiedName(),
$this->row[$offset]);
+ }
+
+ $offset++;
+ }
+
+ if ($criteria->size() > 0)
+ {
+ $affectedRows += BasePeer::doUpdate($selectCriteria, $criteria,
$connection);
+ }
+ }
+
+ return $affectedRows;
+ }
+
+ public function delete($connection = null)
+ {
+ if ($this->deleted)
+ {
+ throw new PropelException('This object has already been deleted.');
+ }
+
+ $affectedRows = 0;
+
+ $criteria = new Criteria;
+ $criteria->add(QubitStatus::ID, $this->id);
+
+ $affectedRows += self::doDelete($criteria, $connection);
+
+ $this->deleted = true;
+
+ return $affectedRows;
+ }
+
+
+ public function getPrimaryKey()
+ {
+ return $this->getid();
+ }
+
+
+ public function setPrimaryKey($key)
+ {
+ $this->setid($key);
+ }
+
+ public static function addJoinobjectCriteria(Criteria $criteria)
+ {
+ $criteria->addJoin(QubitStatus::OBJECT_ID, QubitObject::ID);
+
+ return $criteria;
+ }
+
+ public static function addJointypeCriteria(Criteria $criteria)
+ {
+ $criteria->addJoin(QubitStatus::TYPE_ID, QubitTerm::ID);
+
+ return $criteria;
+ }
+
+ public static function addJoinstatusCriteria(Criteria $criteria)
+ {
+ $criteria->addJoin(QubitStatus::STATUS_ID, QubitTerm::ID);
+
+ return $criteria;
+ }
+
+ public function __call($name, $args)
+ {
+ if ('get' == substr($name, 0, 3) || 'set' == substr($name, 0, 3))
+ {
+ $args = array_merge(array(strtolower(substr($name, 3, 1)).substr($name,
4)), $args);
+
+ return call_user_func_array(array($this, '__'.substr($name, 0, 3)),
$args);
+ }
+
+ throw new sfException('Call to undefined method
'.get_class($this).'::'.$name);
+ }
+}
Modified: trunk/lib/model/om/BaseTerm.php
==============================================================================
--- trunk/lib/model/om/BaseTerm.php Tue Sep 15 11:12:45 2009 (r3308)
+++ trunk/lib/model/om/BaseTerm.php Tue Sep 15 11:35:41 2009 (r3309)
@@ -263,6 +263,16 @@
return true;
}
+ if ('statussRelatedBytypeId' == $name)
+ {
+ return true;
+ }
+
+ if ('statussRelatedBystatusId' == $name)
+ {
+ return true;
+ }
+
if ('systemEvents' == $name)
{
return true;
@@ -832,6 +842,40 @@
return $this->refFkValues['rightsTermRelationsRelatedBytypeId'];
}
+ if ('statussRelatedBytypeId' == $name)
+ {
+ if (!isset($this->refFkValues['statussRelatedBytypeId']))
+ {
+ if (!isset($this->id))
+ {
+ $this->refFkValues['statussRelatedBytypeId'] = QubitQuery::create();
+ }
+ else
+ {
+ $this->refFkValues['statussRelatedBytypeId'] =
self::getstatussRelatedBytypeIdById($this->id, array('self' => $this) +
$options);
+ }
+ }
+
+ return $this->refFkValues['statussRelatedBytypeId'];
+ }
+
+ if ('statussRelatedBystatusId' == $name)
+ {
+ if (!isset($this->refFkValues['statussRelatedBystatusId']))
+ {
+ if (!isset($this->id))
+ {
+ $this->refFkValues['statussRelatedBystatusId'] =
QubitQuery::create();
+ }
+ else
+ {
+ $this->refFkValues['statussRelatedBystatusId'] =
self::getstatussRelatedBystatusIdById($this->id, array('self' => $this) +
$options);
+ }
+ }
+
+ return $this->refFkValues['statussRelatedBystatusId'];
+ }
+
if ('systemEvents' == $name)
{
if (!isset($this->refFkValues['systemEvents']))
@@ -1667,6 +1711,46 @@
return self::addrightsTermRelationsRelatedBytypeIdCriteriaById($criteria,
$this->id);
}
+ public static function addstatussRelatedBytypeIdCriteriaById(Criteria
$criteria, $id)
+ {
+ $criteria->add(QubitStatus::TYPE_ID, $id);
+
+ return $criteria;
+ }
+
+ public static function getstatussRelatedBytypeIdById($id, array $options =
array())
+ {
+ $criteria = new Criteria;
+ self::addstatussRelatedBytypeIdCriteriaById($criteria, $id);
+
+ return QubitStatus::get($criteria, $options);
+ }
+
+ public function addstatussRelatedBytypeIdCriteria(Criteria $criteria)
+ {
+ return self::addstatussRelatedBytypeIdCriteriaById($criteria, $this->id);
+ }
+
+ public static function addstatussRelatedBystatusIdCriteriaById(Criteria
$criteria, $id)
+ {
+ $criteria->add(QubitStatus::STATUS_ID, $id);
+
+ return $criteria;
+ }
+
+ public static function getstatussRelatedBystatusIdById($id, array $options =
array())
+ {
+ $criteria = new Criteria;
+ self::addstatussRelatedBystatusIdCriteriaById($criteria, $id);
+
+ return QubitStatus::get($criteria, $options);
+ }
+
+ public function addstatussRelatedBystatusIdCriteria(Criteria $criteria)
+ {
+ return self::addstatussRelatedBystatusIdCriteriaById($criteria, $this->id);
+ }
+
public static function addsystemEventsCriteriaById(Criteria $criteria, $id)
{
$criteria->add(QubitSystemEvent::TYPE_ID, $id);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---