Development

#5222 (DbFinderPlugin: Explicit join() needed for orderBy)

You must first sign up to be able to contribute.

Ticket #5222 (new documentation)

Opened 4 years ago

Last modified 4 years ago

DbFinderPlugin: Explicit join() needed for orderBy

Reported by: tommyd Assigned to: francois
Priority: minor Milestone:
Component: dbFinderPlugin Version: 1.1.4
Keywords: DbFinderPlugin Cc:
Qualification: Unreviewed

Description

The DbFinderPlugin readme states:

The power of the with() method is that it can guess relationships just as well as join(), and will add the call to join() if you didn't do it yourself.

Apparently this join() is done pretty late in the process, because something like this does not work:

$res = DbFinder::from("A")->with("B","C")->orderBy("C.Id")->find();

This throws the following exception:

sfPropelFinder: APeer has no CPeer related table

The issue can be fixed by explicitely joining B and C:

$res = DbFinder::from("A")->with("B","C")->join("B")->join("C")->orderBy("C.Id")->find();

Maybe this could be mentioned somewhere in the documentation.

Change History

12/08/08 12:12:18 changed by tommyd

  • owner changed from fabien to francois.
  • component changed from other to DbFinderPlugin.