Development

#5091 (sfError404Exception not thrown if sfObjectRoute->getObjects fail to return objects)

You must first sign up to be able to contribute.

Ticket #5091 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

sfError404Exception not thrown if sfObjectRoute->getObjects fail to return objects

Reported by: joes Assigned to: fabien
Priority: major Milestone: 1.2.0
Component: routing Version: 1.2.0 RC1
Keywords: Cc:
Qualification: Unreviewed

Description

This ticket is similar to but not identical to #5090 (that one is about getObject, this one is about getObjects). This problem seems to be specific for when the route is of type sfDoctrineRoute.

On row 143, sfObjectRoute takes a return value of type array with no count to signify a failed retrieve of objects:

143. if (is_array($this->objects) && !count($this->objects) && isset($this->options['allow_empty']) && !$this->options['allow_empty'])

However, if the route is a sfDoctrineRoute this check will fail because the data returned by getObjectsForParameters there doesn't return an array but a object of type Doctrine_Collection. The way to establish if getObjectsForParameters failed would be to call the count method on Doctrine_Collection, like this (untested code!):

143. if ($this->objects->count() == 0 && isset($this->options['allow_empty']) && !$this->options['allow_empty'])

Change History

11/27/08 08:28:52 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [13382]) [1.2] fixed sfObjectRoute to work with Doctrine when no object is returned (closes #5090, #5091)

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.