#1381: Calculated columns don't live well with Identity Map
-----------------------------------+----------------------------------------
Reporter: francois | Owner: jwage
Type: defect | Status: new
Priority: minor | Milestone: Unknown
Component: Attributes | Version: 0.11
Keywords: | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 0
-----------------------------------+----------------------------------------
When adding custom columns to the SELECT part of a DQL statement, Doctrine
makes these columns available as property of the object they are related
to.
Here is a DQL example:
{{{
//Article has many Comments
SELECT c.*, a.title ArticleTitle FROM Comment c INNER JOIN c.Article a
LIMIT 1
// will hydrate a Comment object looking like
-
id: 123
body: I completely agree
article_id: 456
Article:
id: ~
title: ~
body: ~
ArticleTitle: Hello, world
}}}
So that works, since I can retrieve my custom `ArticleTitle` column by
calling `$comment['Article']['ArticleTitle']`.
But if I already queried this Article or this Comment objects, IdentityMap
enters the dance, and the result of the query is:
{{{
-
id: 123
body: I completely agree
article_id: 456
Article:
id: 456
title: Hello, World
body: Lorem Ipsum...
}}}
The bad news is that I can no longer access my custom column by its alias:
`$comment['Article']['ArticleTitle']` doesn't work.
This probably means that IdentityMap should be deactivated on queries
where custom columns are added. I don't know if there is a way to do that,
all I could find was to clear the identity map prior to executing the
query:
{{{
Doctrine::getTable('Article')->clear();
Doctrine::getTable('Comment')->clear();
}}}
This is less than ideal, and should be handled by Doctrine rather than by
the user...
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1381>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-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.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---