Author: david
Date: Tue Feb 22 14:57:23 2011
New Revision: 8992
Log:
Generate actor slugs
Modified:
trunk/lib/task/propelGenerateSlugsTask.class.php
Modified: trunk/lib/task/propelGenerateSlugsTask.class.php
==============================================================================
--- trunk/lib/task/propelGenerateSlugsTask.class.php Tue Feb 22 14:48:58
2011 (r8991)
+++ trunk/lib/task/propelGenerateSlugsTask.class.php Tue Feb 22 14:57:23
2011 (r8992)
@@ -55,7 +55,10 @@
*/
public function execute($arguments = array(), $options = array())
{
- $this->logSection('propel', 'Generate missing slugs...');
+ $databaseManager = new sfDatabaseManager($this->configuration);
+ $conn = $databaseManager->getDatabase('propel')->getConnection();
+
+ $this->logSection('propel', 'Generate infomation object slugs...');
$sql = 'SELECT io.id, i18n.title';
$sql .= ' FROM '.QubitInformationObject::TABLE_NAME.' io';
@@ -66,7 +69,23 @@
$sql .= ' WHERE io.source_culture = i18n.culture';
$sql .= ' AND sl.id is NULL';
- $databaseManager = new sfDatabaseManager($this->configuration);
+ foreach($conn->query($sql, PDO::FETCH_NUM) as $row)
+ {
+ $obj = QubitObject::getById($row[0]);
+ $obj->slug = QubitSlug::slugify($row[1]);
+ $obj->insertSlug($conn);
+ }
+
+ $this->logSection('propel', 'Generate actor slugs...');
+
+ $sql = 'SELECT base.id, i18n.authorized_form_of_name';
+ $sql .= ' FROM '.QubitActor::TABLE_NAME.' base';
+ $sql .= ' INNER JOIN '.QubitActorI18n::TABLE_NAME.' i18n';
+ $sql .= ' ON base.id = i18n.id';
+ $sql .= ' LEFT JOIN '.QubitSlug::TABLE_NAME.' sl';
+ $sql .= ' ON base.id = sl.object_id';
+ $sql .= ' WHERE base.source_culture = i18n.culture';
+ $sql .= ' AND sl.id is NULL';
$conn = $databaseManager->getDatabase('propel')->getConnection();
--
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=en.