Author: dwhittle
Date: 2008-10-20 01:57:39 +0200 (Mon, 20 Oct 2008)
New Revision: 12262
Modified:
branches/dwhittle/1.2/lib/routing/sfObjectRoute.class.php
branches/dwhittle/1.2/lib/routing/sfObjectRouteCollection.class.php
Log:
dwhittle: merged changes to branch
Modified: branches/dwhittle/1.2/lib/routing/sfObjectRoute.class.php
===================================================================
--- branches/dwhittle/1.2/lib/routing/sfObjectRoute.class.php 2008-10-19
23:12:48 UTC (rev 12261)
+++ branches/dwhittle/1.2/lib/routing/sfObjectRoute.class.php 2008-10-19
23:57:39 UTC (rev 12262)
@@ -20,6 +20,10 @@
*/
class sfObjectRoute extends sfRequestRoute
{
+ protected
+ $object = false,
+ $objects = false;
+
/**
* Constructor.
*
@@ -96,13 +100,18 @@
throw new LogicException(sprintf('The route "%s" is not of type
"object".', $this->pattern));
}
+ if (false !== $this->object)
+ {
+ return $this->object;
+ }
+
// check the related object
- if (is_null($object = $this->getObjectForParameters($this->parameters)) &&
(!isset($this->options['allow_empty']) || !$this->options['allow_empty']))
+ if (is_null($this->object =
$this->getObjectForParameters($this->parameters)) &&
(!isset($this->options['allow_empty']) || !$this->options['allow_empty']))
{
throw new sfError404Exception(sprintf('Unable to find the %s object with
the following parameters "%s").', $this->options['model'], str_replace("\n",
'', var_export($this->filterParameters($this->parameters), true))));
}
- return $object;
+ return $this->object;
}
/**
@@ -124,14 +133,19 @@
throw new LogicException(sprintf('The route "%s" is not of type
"list".', $this->pattern));
}
- $objects = $this->getObjectsForParameters($this->parameters);
+ if (false !== $this->objects)
+ {
+ return $this->objects;
+ }
- if (is_array($objects) && !count($objects) &&
isset($this->options['allow_empty']) && !$this->options['allow_empty'])
+ $this->objects = $this->getObjectsForParameters($this->parameters);
+
+ if (is_array($this->objects) && !count($this->objects) &&
isset($this->options['allow_empty']) && !$this->options['allow_empty'])
{
throw new sfError404Exception(sprintf('No %s object found for the
following parameters "%s").', $this->options['model'], str_replace("\n", '',
var_export($this->filterParameters($this->parameters), true))));
}
- return $objects;
+ return $this->objects;
}
protected function getObjectForParameters($parameters)
Modified: branches/dwhittle/1.2/lib/routing/sfObjectRouteCollection.class.php
===================================================================
--- branches/dwhittle/1.2/lib/routing/sfObjectRouteCollection.class.php
2008-10-19 23:12:48 UTC (rev 12261)
+++ branches/dwhittle/1.2/lib/routing/sfObjectRouteCollection.class.php
2008-10-19 23:57:39 UTC (rev 12262)
@@ -143,7 +143,7 @@
protected function getDefaultActions()
{
- $actions = array('list', 'new', 'create', 'show', 'edit', 'update',
'delete');
+ $actions = array('list', 'new', 'create', 'edit', 'update', 'delete');
if ($this->options['with_show'])
{
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony SVN" 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/symfony-svn?hl=en
-~----------~----~----~----~------~----~------~--~---