Author: sevein
Date: Thu Oct 13 17:08:01 2011
New Revision: 10088
Log:
Create specific class for resource routes under SWORD plugin to stop throwing
404 exceptions before action execution, I need to insert a XML document in the
404 response
Added:
trunk/plugins/qtSwordPlugin/lib/qtSwordResourceRoute.class.php
Modified:
trunk/apps/qubit/config/routing.yml
Modified: trunk/apps/qubit/config/routing.yml
==============================================================================
--- trunk/apps/qubit/config/routing.yml Thu Oct 13 17:06:04 2011 (r10087)
+++ trunk/apps/qubit/config/routing.yml Thu Oct 13 17:08:01 2011 (r10088)
@@ -11,7 +11,7 @@
sword/action/slug:
url: /sword/:action/:slug
- class: QubitResourceRoute
+ class: qtSwordResourceRoute
param:
module: qtSwordPlugin
slug: { pattern: '[^;]+' }
Added: trunk/plugins/qtSwordPlugin/lib/qtSwordResourceRoute.class.php
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/plugins/qtSwordPlugin/lib/qtSwordResourceRoute.class.php Thu Oct
13 17:08:01 2011 (r10088)
@@ -0,0 +1,32 @@
+<?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 qtSwordResourceRoute extends QubitRoute
+{
+ public function bind($context, $params)
+ {
+ $criteria = new Criteria;
+ $criteria->add(QubitSlug::SLUG, $params['slug']);
+ $criteria->addJoin(QubitSlug::OBJECT_ID, QubitObject::ID);
+
+ $this->resource = QubitObject::get($criteria)->__get(0);
+
+ return parent::bind($context, $params);
+ }
+}
--
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.