Thanks for the interest in my problem, Richtermister.
The code I have shown above accounts only for a small part of my
model, but I thought it would be sufficient to convey the point. There
really isn't anything special about the Option 0,1,2,3,... etc, but I
will provide you with as much information as I can considering the
nature of the project
Consider the following:
The Record model accounts for a particular governmental system. It has
the name and address of the person who submitted the request, an
unique number, and a few other miscellaneous fields.
There is a second model, RecordCriteria, tied in a 1:1 relationship
with the first model. It has only boolean fields representing
different sets of requirements that the applicant must meet, and a
single float field that calculates the "weight" of the application,
based on the requirements.

There are MANY queries run on those 2 tables, and often a lot of
records have to be displayed at once. Of course, this results in an
additional query being executed for every single record that I show.
This should really be avoided. It results in over 800 queries on one
particular page, where about 10 should suffice.

Normally Propel provides doSelectJoin(related_table) methods, and when
I was designing the database, I believed that it would do so for the
1:1 relation too, providing something like
RecordPeer::doSelectJoinRecordCriteria().  I was wrong. No automatic
method for joining the related table is available.

So my question is simply, how to do a custom join for 1:1 in Propel
1.3, in a fashion similar to what David Ashwood purposed. As I
mentioned, the resources he provided are unfortunately not applicable
to Propel 1.3.



On May 21, 8:57 pm, Richtermeister <nex...@gmail.com> wrote:
> Hey Crafty,
>
> I think one issue is that it's not really clear what you're trying to
> do..
> I have no idea what this option0 / option1 setup is all about..
>
> If you can give an example of what you're trying to do, maybe we can
> help better.
>
> Daniel
>
> On May 20, 3:20 pm, Crafty_Shadow <vankat...@gmail.com> wrote:
>
> > Once again, a shameless bump!
>
> > I tried several approaches to no avail.
> > Halp!
>
> > On May 19, 12:48 pm, Crafty_Shadow <vankat...@gmail.com> wrote:
>
> > > Thanks for the links, but those are of no help to me.
>
> > > Each and every single of the resources you have pointed me to are
> > > about propel 1.2.
> > > As I mentioned in my original post, I have written such behavior for
> > > propel 1.2, but the problem is that I'm currently dealing with 1.3,
> > > which is quite different.
>
> > > On May 19, 12:09 pm, "David Ashwood" <da...@inspiredthinking.co.uk>
> > > wrote:
>
> > > > Some links that talk about what you're after:
>
> > > >http://forum.symfony-project.org/index.php/m/14692/http://groups.goog......
> > > > cb274ehttp://trac.symfony-project.org/wiki/ApplyingCustomJoinsInDoSelect
>
> > > > And a plugin written that appears to do what you're 
> > > > after:http://www.symfony-project.org/plugins/sfPropelImpersonatorPlugin
>
> > > > Alternatively there's also the DbFinder plugin that gives you more 
> > > > control
> > > > over what's happening and a very good way to have an app that allows 
> > > > you to
> > > > switch ORM later should you wish to jump to Doctrine (far cleaner and 
> > > > more
> > > > flexible than Propel imho):
>
> > > >http://www.symfony-project.org/plugins/DbFinderPlugin
>
> > > > -----Original Message-----
> > > > From: symfony-users@googlegroups.com 
> > > > [mailto:symfony-us...@googlegroups.com]
>
> > > > On Behalf Of Crafty_Shadow
> > > > Sent: 19 May 2009 10:52
> > > > To: symfony users
> > > > Subject: [symfony-users] Re: Propel and 1:1 relationships
>
> > > > I am going to perform what is know as "a shameless bump".
> > > > I believe that this problem requires discussion, as having a 1:1
> > > > relationship should be fairly common, and it is only natural to seek
> > > > way optimize it's workings.
>
> > > > On May 17, 7:14 pm, Crafty_Shadow <vankat...@gmail.com> wrote:
> > > > > Hey guys,
> > > > > I have the following question - how do I makepropelhydrate1:1
> > > > > relationships automatically ?
> > > > > When we have a normal 1:m relationship the peer class provides methods
> > > > > like doSelectJoinWhaever, but no such method is available when using 
> > > > > a1:1
> > > > > The relation itself works just as it's expected to, but every call to
> > > > > get the related object results in an extra query.
>
> > > > > from my schema.yml:
>
> > > > >   record:
> > > > >     id:                 ~
> > > > >     sequential_number:  { type:      integer, required: true }
> > > > >     status:             { type:     smallint, required: true }
> > > > >   record_option:
> > > > >     id:               { type: integer, primaryKey: true, foreignTable:
> > > > > record, foreignReference: id, required: true, onDelete: cascade }
> > > >  ##1:1relational mapping
> > > > >     option0:       { type: boolean, default: false }
> > > > >     option1:       { type: boolean, default: false }
>
> > > > > $record->getRecordOption()->getOption0();  <- an extra query here, and
> > > > > given that I have to show MANY records at once (many being a random
> > > > > number between 10 and 5000, without pagination - as required by
> > > > > application specifications) this could prove to be a pretty serious
> > > > > issue
>
> > > > > Simply adding a join clause to the criteria does nothing, I suppose I
> > > > > need to override the hydration.
> > > > > I have used the method described
> > > > here:http://trac.symfony-project.org/wiki/ApplyingCustomJoinsInDoSelecton
> > > > > previous projects, but this project usesPropel1.3 and this is 
> > > > > forPropel1.2
>
> > > > > Any help would be deeply appreciated
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to