Ticket #1124 (closed defect: fixed)

Opened 13 months ago

Last modified 10 months ago

Magic finder methods fail for aliased columns

Reported by: berdahl Owned by: romanb
Priority: major Milestone:
Component: Query/Hydration Version: 0.11.0
Severity: Keywords:
Cc: Has Test: yes
Status: Pending Core Response Has Patch: no

Description

If a record declares columns that are aliased, those columns will not work with magic finders. For example, a record that contains a column declaration like…

$this->hasColumn('column_name as aliasedColumnName', 'integer', 4);

…should be findable using a magic finder like…

$record = $table->findOneByAliasedColumnName(4);

When this is attempted using doctrine 0.11rc3, one observes an exception thrown from deep inside doctine. See the attached unit test case to demonstrate various cases that should run, as written, but fail when run added to the set of unit tests run by automated test runs.

Code inspection suggests that the fundamental failure is in Doctrine_Table::call, which calls Doctrine_Inflector::tableize on the string extracted from the magic function (i.e. removing the 'findOneBy' or 'findBy' prefix) and treats the tableized result as a field name.

Attachments

EMB1TestCase.php (2.2 KB) - added by berdahl 13 months ago.
unit test case that demonstrates and tests the conditions described in the bug

Change History

Changed 13 months ago by berdahl

unit test case that demonstrates and tests the conditions described in the bug

Changed 12 months ago by jwage

  • milestone changed from 0.11.3 to 0.11.1

Changed 12 months ago by jwage

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

(In [4595]) fixes #1124

Changed 10 months ago by anonymous

  • milestone New deleted

Milestone New deleted

Note: See TracTickets for help on using tickets.