Development

#3895 ([PATCH] sfPropelFinder cannot find relation between objects)

You must first sign up to be able to contribute.

Ticket #3895 (closed defect: fixed)

Opened 5 months ago

Last modified 5 months ago

[PATCH] sfPropelFinder cannot find relation between objects

Reported by: mrhyde Assigned to: francois
Priority: minor Milestone:
Component: sfPropelFinderPlugin Version: 1.0.17
Keywords: Cc:
Qualification: Unreviewed

Description

sfPropelFinder has hardcoded mechanizm of mapping table names to class names which overrides ORM. It expectes that class name is camelize version of table name otherwise you cannot use with() or join() methods (Excetion sfPropelFinder: %s has no %s related table. is thrown).

Proposed patch solves the issue and retrieves all mapping information from Propel.

Attachments

sfPropelFinder.php.patch (1.5 kB) - added by mrhyde on 07/03/08 11:39:47.

Change History

07/03/08 11:39:47 changed by mrhyde

  • attachment sfPropelFinder.php.patch added.

07/03/08 18:03:27 changed by francois

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

(In [10101]) sfPropelFinderPlugin Fixed problem when guessing relation on a table with a special phpName (based on a patch from mrhyde) (closes #3895)

07/03/08 18:22:23 changed by Richtermeister

Just looking at the code it seems you inserted a return statement which is followed by some code that is never executed.. Are you sure this patch correctly finds relations between tables without special phpName? Also you can test if the related table map has been build already via

$c -> getTable() -> getDatabaseMap() -> containsTable($c -> getRelatedTableName())

so you wouldn't have so "silence" the propel exception.. (is silencing an exception a good idea?)

Just my 2 cents, if you like you can look at the solution I proposed 2 days ago http://trac.symfony-project.org/attachment/ticket/3883/sfPropelFinder.php

-Daniel

07/03/08 18:37:16 changed by francois

Look again, I changed that a couple minutes ago, without using the exception but instead your solution.

As for your attached class, it is difficult to compare it with mine since there has been a lot of changes inbetween. Next time, try to attach a patch file instead of a full file.