Author: david
Date: Wed Nov 18 16:51:37 2009
New Revision: 3917
Log:
Change q_actor_name table -> q_other_name to allow using it for functions (and
other objects).
Added:
trunk/lib/model/QubitOtherName.php (contents, props changed)
- copied, changed from r3912, trunk/lib/model/QubitActorName.php
trunk/lib/model/QubitOtherNameI18n.php (contents, props changed)
- copied, changed from r3912, trunk/lib/model/QubitActorNameI18n.php
Deleted:
trunk/lib/model/QubitActorName.php
trunk/lib/model/QubitActorNameI18n.php
trunk/lib/model/map/ActorNameI18nMapBuilder.php
trunk/lib/model/map/ActorNameMapBuilder.php
trunk/lib/model/om/BaseActorName.php
trunk/lib/model/om/BaseActorNameI18n.php
Modified:
trunk/apps/qubit/modules/actor/actions/deleteOtherNameAction.class.php
trunk/apps/qubit/modules/actor/actions/editAction.class.php
trunk/apps/qubit/modules/repository/actions/editIsdiahAction.class.php
trunk/config/schema.yml
trunk/data/sql/lib.model.schema.sql
trunk/lib/model/QubitActor.php
trunk/lib/model/QubitRepository.php
trunk/lib/model/QubitTerm.php
trunk/lib/model/om/BaseActor.php
trunk/lib/model/om/BaseObject.php
trunk/lib/model/om/BaseTerm.php
Modified: trunk/apps/qubit/modules/actor/actions/deleteOtherNameAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/actor/actions/deleteOtherNameAction.class.php
Wed Nov 18 15:17:19 2009 (r3916)
+++ trunk/apps/qubit/modules/actor/actions/deleteOtherNameAction.class.php
Wed Nov 18 16:51:37 2009 (r3917)
@@ -21,9 +21,9 @@
{
public function execute($request)
{
- $this->deleteOtherName =
QubitActorName::getById($this->getRequestParameter('otherNameId'));
+ $this->deleteOtherName =
QubitOtherName::getById($this->getRequestParameter('otherNameId'));
$this->forward404Unless($this->deleteOtherName);
- $this->actorId = $this->deleteOtherName->getActorId();
+ $this->actorId = $this->deleteOtherName->getObjectId();
// Do delete
$this->deleteOtherName->delete();
Modified: trunk/apps/qubit/modules/actor/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/actor/actions/editAction.class.php Wed Nov 18
15:17:19 2009 (r3916)
+++ trunk/apps/qubit/modules/actor/actions/editAction.class.php Wed Nov 18
16:51:37 2009 (r3917)
@@ -52,7 +52,7 @@
//Other Forms of Name
$this->otherNames = $this->actor->getOtherNames();
- $this->newName = new QubitActorName;
+ $this->newName = new QubitOtherName;
//Properties
$this->languageCodes = $this->actor->getProperties($name =
'language_of_actor_description');
Modified: trunk/apps/qubit/modules/repository/actions/editIsdiahAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/repository/actions/editIsdiahAction.class.php
Wed Nov 18 15:17:19 2009 (r3916)
+++ trunk/apps/qubit/modules/repository/actions/editIsdiahAction.class.php
Wed Nov 18 16:51:37 2009 (r3917)
@@ -81,7 +81,7 @@
{
foreach ((array) $this->request->getParameter('delete_parallel_names')
as $id => $val)
{
- QubitActorName::deleteById($id);
+ QubitOtherName::deleteById($id);
}
}
@@ -89,7 +89,7 @@
{
foreach ((array) $this->request->getParameter('delete_other_names') as
$id => $val)
{
- QubitActorName::deleteById($id);
+ QubitOtherName::deleteById($id);
}
}
}
Modified: trunk/config/schema.yml
==============================================================================
--- trunk/config/schema.yml Wed Nov 18 15:17:19 2009 (r3916)
+++ trunk/config/schema.yml Wed Nov 18 16:51:37 2009 (r3917)
@@ -25,13 +25,13 @@
sources: longvarchar
revision_history: longvarchar
- actor_name:
- actor_id: { type: integer, required: true, foreignTable: actor,
foreignReference: id, onDelete: cascade }
+ other_name:
+ object_id: { type: integer, required: true, foreignTable: object,
foreignReference: id, onDelete: cascade }
type_id: { type: integer, foreignTable: term, foreignReference: id,
onDelete: setnull }
created_at:
updated_at:
- actor_name_i18n:
+ other_name_i18n:
name: varchar(255)
note: varchar(255)
Modified: trunk/data/sql/lib.model.schema.sql
==============================================================================
--- trunk/data/sql/lib.model.schema.sql Wed Nov 18 15:17:19 2009 (r3916)
+++ trunk/data/sql/lib.model.schema.sql Wed Nov 18 16:51:37 2009 (r3917)
@@ -81,15 +81,15 @@
)Type=InnoDB;
#-----------------------------------------------------------------------------
-#-- q_actor_name
+#-- q_other_name
#-----------------------------------------------------------------------------
-DROP TABLE IF EXISTS `q_actor_name`;
+DROP TABLE IF EXISTS `q_other_name`;
-CREATE TABLE `q_actor_name`
+CREATE TABLE `q_other_name`
(
- `actor_id` INTEGER NOT NULL,
+ `object_id` INTEGER NOT NULL,
`type_id` INTEGER,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL,
@@ -97,26 +97,26 @@
`id` INTEGER NOT NULL AUTO_INCREMENT,
`serial_number` INTEGER NOT NULL,
PRIMARY KEY (`id`),
- INDEX `q_actor_name_FI_1` (`actor_id`),
- CONSTRAINT `q_actor_name_FK_1`
- FOREIGN KEY (`actor_id`)
- REFERENCES `q_actor` (`id`)
+ INDEX `q_other_name_FI_1` (`object_id`),
+ CONSTRAINT `q_other_name_FK_1`
+ FOREIGN KEY (`object_id`)
+ REFERENCES `q_object` (`id`)
ON DELETE CASCADE,
- INDEX `q_actor_name_FI_2` (`type_id`),
- CONSTRAINT `q_actor_name_FK_2`
+ INDEX `q_other_name_FI_2` (`type_id`),
+ CONSTRAINT `q_other_name_FK_2`
FOREIGN KEY (`type_id`)
REFERENCES `q_term` (`id`)
ON DELETE SET NULL
)Type=InnoDB;
#-----------------------------------------------------------------------------
-#-- q_actor_name_i18n
+#-- q_other_name_i18n
#-----------------------------------------------------------------------------
-DROP TABLE IF EXISTS `q_actor_name_i18n`;
+DROP TABLE IF EXISTS `q_other_name_i18n`;
-CREATE TABLE `q_actor_name_i18n`
+CREATE TABLE `q_other_name_i18n`
(
`name` VARCHAR(255),
`note` VARCHAR(255),
@@ -124,9 +124,9 @@
`culture` VARCHAR(7) NOT NULL,
`serial_number` INTEGER NOT NULL,
PRIMARY KEY (`id`,`culture`),
- CONSTRAINT `q_actor_name_i18n_FK_1`
+ CONSTRAINT `q_other_name_i18n_FK_1`
FOREIGN KEY (`id`)
- REFERENCES `q_actor_name` (`id`)
+ REFERENCES `q_other_name` (`id`)
ON DELETE CASCADE
)Type=InnoDB;
Modified: trunk/lib/model/QubitActor.php
==============================================================================
--- trunk/lib/model/QubitActor.php Wed Nov 18 15:17:19 2009 (r3916)
+++ trunk/lib/model/QubitActor.php Wed Nov 18 16:51:37 2009 (r3917)
@@ -301,16 +301,16 @@
public function getOtherNames()
{
$criteria = new Criteria;
- $criteria->addJoin(QubitActorName::TYPE_ID, QubitTerm::ID);
- $criteria->add(QubitActorName::ACTOR_ID, $this->getId());
+ $criteria->addJoin(QubitOtherName::TYPE_ID, QubitTerm::ID);
+ $criteria->add(QubitOtherName::OBJECT_ID, $this->getId());
- return QubitActorName::get($criteria);
+ return QubitOtherName::get($criteria);
}
public function setOtherNames($otherName, $nameTypeId, $nameNote)
{
- $newName = new QubitActorName;
- $newName->setActorId($this->getId());
+ $newName = new QubitOtherName;
+ $newName->setObjectId($this->getId());
$newName->setName($otherName);
$newName->setTypeId($nameTypeId);
$newName->setNote($nameNote);
Copied and modified: trunk/lib/model/QubitOtherName.php (from r3912,
trunk/lib/model/QubitActorName.php)
==============================================================================
--- trunk/lib/model/QubitActorName.php Wed Nov 18 13:43:12 2009 (r3912,
copy source)
+++ trunk/lib/model/QubitOtherName.php Wed Nov 18 16:51:37 2009 (r3917)
@@ -17,7 +17,7 @@
* along with Qubit Toolkit. If not, see <http://www.gnu.org/licenses/>.
*/
-class QubitActorName extends BaseActorName
+class QubitOtherName extends BaseOtherName
{
public function __toString()
{
Copied and modified: trunk/lib/model/QubitOtherNameI18n.php (from r3912,
trunk/lib/model/QubitActorNameI18n.php)
==============================================================================
--- trunk/lib/model/QubitActorNameI18n.php Wed Nov 18 13:43:12 2009
(r3912, copy source)
+++ trunk/lib/model/QubitOtherNameI18n.php Wed Nov 18 16:51:37 2009
(r3917)
@@ -17,6 +17,6 @@
* along with Qubit Toolkit. If not, see <http://www.gnu.org/licenses/>.
*/
-class QubitActorNameI18n extends BaseActorNameI18n
+class QubitOtherNameI18n extends BaseOtherNameI18n
{
}
Modified: trunk/lib/model/QubitRepository.php
==============================================================================
--- trunk/lib/model/QubitRepository.php Wed Nov 18 15:17:19 2009 (r3916)
+++ trunk/lib/model/QubitRepository.php Wed Nov 18 16:51:37 2009 (r3917)
@@ -296,10 +296,10 @@
public function getParallelFormsOfName()
{
$c = new Criteria;
- $c->add(QubitActorName::TYPE_ID, QubitTerm::PARALLEL_FORM_OF_NAME_ID,
Criteria::EQUAL);
- $c->addAnd(QubitActorName::ACTOR_ID, $this->getId(), Criteria::EQUAL);
+ $c->add(QubitOtherName::TYPE_ID, QubitTerm::PARALLEL_FORM_OF_NAME_ID,
Criteria::EQUAL);
+ $c->addAnd(QubitOtherName::OBJECT_ID, $this->getId(), Criteria::EQUAL);
- return QubitActorName::get($c);
+ return QubitOtherName::get($c);
}
/**
@@ -310,10 +310,10 @@
public function getOtherFormsOfName()
{
$c = new Criteria;
- $c->add(QubitActorName::TYPE_ID, QubitTerm::OTHER_FORM_OF_NAME_ID,
Criteria::EQUAL);
- $c->addAnd(QubitActorName::ACTOR_ID, $this->getId(), Criteria::EQUAL);
+ $c->add(QubitOtherName::TYPE_ID, QubitTerm::OTHER_FORM_OF_NAME_ID,
Criteria::EQUAL);
+ $c->addAnd(QubitOtherName::OBJECT_ID, $this->getId(), Criteria::EQUAL);
- return QubitActorName::get($c);
+ return QubitOtherName::get($c);
}
/**
Modified: trunk/lib/model/QubitTerm.php
==============================================================================
--- trunk/lib/model/QubitTerm.php Wed Nov 18 15:17:19 2009 (r3916)
+++ trunk/lib/model/QubitTerm.php Wed Nov 18 16:51:37 2009 (r3917)
@@ -476,8 +476,8 @@
*/
public function getRelatedActorNameCount()
{
- $sql = 'SELECT COUNT(*) FROM '.QubitActorName::TABLE_NAME;
- $sql .= ' WHERE '.QubitActorName::TYPE_ID.' = '.$this->getId();
+ $sql = 'SELECT COUNT(*) FROM '.QubitOtherName::TABLE_NAME;
+ $sql .= ' WHERE '.QubitOtherName::TYPE_ID.' = '.$this->getId();
return self::executeCount($sql);
}
Modified: trunk/lib/model/om/BaseActor.php
==============================================================================
--- trunk/lib/model/om/BaseActor.php Wed Nov 18 15:17:19 2009 (r3916)
+++ trunk/lib/model/om/BaseActor.php Wed Nov 18 16:51:37 2009 (r3917)
@@ -108,11 +108,6 @@
return true;
}
- if ('actorNames' == $name)
- {
- return true;
- }
-
if ('contactInformations' == $name)
{
return true;
@@ -196,23 +191,6 @@
return $this->refFkValues['actorI18ns'];
}
- if ('actorNames' == $name)
- {
- if (!isset($this->refFkValues['actorNames']))
- {
- if (!isset($this->id))
- {
- $this->refFkValues['actorNames'] = QubitQuery::create();
- }
- else
- {
- $this->refFkValues['actorNames'] =
self::getactorNamesById($this->id, array('self' => $this) + $options);
- }
- }
-
- return $this->refFkValues['actorNames'];
- }
-
if ('contactInformations' == $name)
{
if (!isset($this->refFkValues['contactInformations']))
@@ -406,26 +384,6 @@
return self::addactorI18nsCriteriaById($criteria, $this->id);
}
- public static function addactorNamesCriteriaById(Criteria $criteria, $id)
- {
- $criteria->add(QubitActorName::ACTOR_ID, $id);
-
- return $criteria;
- }
-
- public static function getactorNamesById($id, array $options = array())
- {
- $criteria = new Criteria;
- self::addactorNamesCriteriaById($criteria, $id);
-
- return QubitActorName::get($criteria, $options);
- }
-
- public function addactorNamesCriteria(Criteria $criteria)
- {
- return self::addactorNamesCriteriaById($criteria, $this->id);
- }
-
public static function addcontactInformationsCriteriaById(Criteria
$criteria, $id)
{
$criteria->add(QubitContactInformation::ACTOR_ID, $id);
Modified: trunk/lib/model/om/BaseObject.php
==============================================================================
--- trunk/lib/model/om/BaseObject.php Wed Nov 18 15:17:19 2009 (r3916)
+++ trunk/lib/model/om/BaseObject.php Wed Nov 18 16:51:37 2009 (r3917)
@@ -180,6 +180,16 @@
}
}
+ if ('aclPermissions' == $name)
+ {
+ return true;
+ }
+
+ if ('otherNames' == $name)
+ {
+ return true;
+ }
+
if ('notes' == $name)
{
return true;
@@ -215,11 +225,6 @@
return true;
}
- if ('aclPermissions' == $name)
- {
- return true;
- }
-
throw new sfException('Unknown record property "'.$name.'" on
"'.get_class($this).'"');
}
@@ -261,6 +266,40 @@
}
}
+ if ('aclPermissions' == $name)
+ {
+ if (!isset($this->refFkValues['aclPermissions']))
+ {
+ if (!isset($this->id))
+ {
+ $this->refFkValues['aclPermissions'] = QubitQuery::create();
+ }
+ else
+ {
+ $this->refFkValues['aclPermissions'] =
self::getaclPermissionsById($this->id, array('self' => $this) + $options);
+ }
+ }
+
+ return $this->refFkValues['aclPermissions'];
+ }
+
+ if ('otherNames' == $name)
+ {
+ if (!isset($this->refFkValues['otherNames']))
+ {
+ if (!isset($this->id))
+ {
+ $this->refFkValues['otherNames'] = QubitQuery::create();
+ }
+ else
+ {
+ $this->refFkValues['otherNames'] =
self::getotherNamesById($this->id, array('self' => $this) + $options);
+ }
+ }
+
+ return $this->refFkValues['otherNames'];
+ }
+
if ('notes' == $name)
{
if (!isset($this->refFkValues['notes']))
@@ -380,23 +419,6 @@
return $this->refFkValues['statuss'];
}
- if ('aclPermissions' == $name)
- {
- if (!isset($this->refFkValues['aclPermissions']))
- {
- if (!isset($this->id))
- {
- $this->refFkValues['aclPermissions'] = QubitQuery::create();
- }
- else
- {
- $this->refFkValues['aclPermissions'] =
self::getaclPermissionsById($this->id, array('self' => $this) + $options);
- }
- }
-
- return $this->refFkValues['aclPermissions'];
- }
-
throw new sfException('Unknown record property "'.$name.'" on
"'.get_class($this).'"');
}
@@ -653,6 +675,46 @@
$this->setid($key);
}
+ public static function addaclPermissionsCriteriaById(Criteria $criteria, $id)
+ {
+ $criteria->add(QubitAclPermission::OBJECT_ID, $id);
+
+ return $criteria;
+ }
+
+ public static function getaclPermissionsById($id, array $options = array())
+ {
+ $criteria = new Criteria;
+ self::addaclPermissionsCriteriaById($criteria, $id);
+
+ return QubitAclPermission::get($criteria, $options);
+ }
+
+ public function addaclPermissionsCriteria(Criteria $criteria)
+ {
+ return self::addaclPermissionsCriteriaById($criteria, $this->id);
+ }
+
+ public static function addotherNamesCriteriaById(Criteria $criteria, $id)
+ {
+ $criteria->add(QubitOtherName::OBJECT_ID, $id);
+
+ return $criteria;
+ }
+
+ public static function getotherNamesById($id, array $options = array())
+ {
+ $criteria = new Criteria;
+ self::addotherNamesCriteriaById($criteria, $id);
+
+ return QubitOtherName::get($criteria, $options);
+ }
+
+ public function addotherNamesCriteria(Criteria $criteria)
+ {
+ return self::addotherNamesCriteriaById($criteria, $this->id);
+ }
+
public static function addnotesCriteriaById(Criteria $criteria, $id)
{
$criteria->add(QubitNote::OBJECT_ID, $id);
@@ -793,26 +855,6 @@
return self::addstatussCriteriaById($criteria, $this->id);
}
- public static function addaclPermissionsCriteriaById(Criteria $criteria, $id)
- {
- $criteria->add(QubitAclPermission::OBJECT_ID, $id);
-
- return $criteria;
- }
-
- public static function getaclPermissionsById($id, array $options = array())
- {
- $criteria = new Criteria;
- self::addaclPermissionsCriteriaById($criteria, $id);
-
- return QubitAclPermission::get($criteria, $options);
- }
-
- public function addaclPermissionsCriteria(Criteria $criteria)
- {
- return self::addaclPermissionsCriteriaById($criteria, $this->id);
- }
-
public function __call($name, $args)
{
if ('get' == substr($name, 0, 3) || 'set' == substr($name, 0, 3))
Modified: trunk/lib/model/om/BaseTerm.php
==============================================================================
--- trunk/lib/model/om/BaseTerm.php Wed Nov 18 15:17:19 2009 (r3916)
+++ trunk/lib/model/om/BaseTerm.php Wed Nov 18 16:51:37 2009 (r3917)
@@ -124,7 +124,7 @@
return true;
}
- if ('actorNames' == $name)
+ if ('otherNames' == $name)
{
return true;
}
@@ -379,21 +379,21 @@
return $this->refFkValues['actorsRelatedBydescriptionDetailId'];
}
- if ('actorNames' == $name)
+ if ('otherNames' == $name)
{
- if (!isset($this->refFkValues['actorNames']))
+ if (!isset($this->refFkValues['otherNames']))
{
if (!isset($this->id))
{
- $this->refFkValues['actorNames'] = QubitQuery::create();
+ $this->refFkValues['otherNames'] = QubitQuery::create();
}
else
{
- $this->refFkValues['actorNames'] =
self::getactorNamesById($this->id, array('self' => $this) + $options);
+ $this->refFkValues['otherNames'] =
self::getotherNamesById($this->id, array('self' => $this) + $options);
}
}
- return $this->refFkValues['actorNames'];
+ return $this->refFkValues['otherNames'];
}
if ('digitalObjectsRelatedByusageId' == $name)
@@ -1165,24 +1165,24 @@
return self::addactorsRelatedBydescriptionDetailIdCriteriaById($criteria,
$this->id);
}
- public static function addactorNamesCriteriaById(Criteria $criteria, $id)
+ public static function addotherNamesCriteriaById(Criteria $criteria, $id)
{
- $criteria->add(QubitActorName::TYPE_ID, $id);
+ $criteria->add(QubitOtherName::TYPE_ID, $id);
return $criteria;
}
- public static function getactorNamesById($id, array $options = array())
+ public static function getotherNamesById($id, array $options = array())
{
$criteria = new Criteria;
- self::addactorNamesCriteriaById($criteria, $id);
+ self::addotherNamesCriteriaById($criteria, $id);
- return QubitActorName::get($criteria, $options);
+ return QubitOtherName::get($criteria, $options);
}
- public function addactorNamesCriteria(Criteria $criteria)
+ public function addotherNamesCriteria(Criteria $criteria)
{
- return self::addactorNamesCriteriaById($criteria, $this->id);
+ return self::addotherNamesCriteriaById($criteria, $this->id);
}
public static function
adddigitalObjectsRelatedByusageIdCriteriaById(Criteria $criteria, $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.com/group/qubit-commits?hl=.