How to do multiple join without foreign key (and without virtual foreign key)

Showing 1-7 of 7 messages
How to do multiple join without foreign key (and without virtual foreign key) Ventzy Kunev 2/2/12 3:11 PM
Want to join this two tables:

project:
  id

rel:
  object_id
  object_type

Wanted SQL:
SELECT ... FROM project INNER JOIN rel ON (project.id = rel.object_id
AND rel.object_type = 'project')

I can do this with addMultipleJoin, but it is deprecated now:
ProjectQuery::create()
  ->addMultipleJoin(array(
     array('project.id', 'rel.object_id'),
     array('rel.object_type', "'project'")
  ));
Re: [propel] How to do multiple join without foreign key (and without virtual foreign key) Francois Zaninotto 2/6/12 3:02 AM
Hi [whatsyourname?],

I realize this isn't part of the reference documentation (you can open a ticket to remind us to fix it), but the feature is called addJoinCondition and is documented here:


Cheers,

François

2012/2/3 Ventzy <v.k...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Propel Users" group.
To post to this group, send email to propel...@googlegroups.com.
To unsubscribe from this group, send email to propel-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/propel-users?hl=en.


Re: How to do multiple join without foreign key (and without virtual foreign key) Ventzy Kunev 2/10/12 3:18 AM
I am aware of addJoinCondition(), but my tables are not related with
foreign key, so I cannot call join() and then addJoinCondition(), like
in the example. I must specify explicitly all fields for the join,
which I can do with addMultipleJoin().

There is not way to specify "name" for addJoin, so I cannot call
addJoinCondition() later for that join.
I tried to manually create Join object, but can't make it work.
Re: [propel] Re: How to do multiple join without foreign key (and without virtual foreign key) Francois Zaninotto 2/10/12 4:59 AM
Hi [PleaseDontBerudeAndIntroduceYourselfOtherwiseIWontAnswerYouAnymore],

Propel provides a low-level API for that kind of hacking. The Join object is there for you. Read the phpDoc, create a Join that fits your needs, and then add it to the Criteria.

If you can't, then just write the query in SQL, execute it using PDO, then hydrate the objects yourself.


Cheers,

François

2012/2/10 Ventzy <v.k...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Propel Users" group.
To post to this group, send email to propel...@googlegroups.com.
To unsubscribe from this group, send email to propel-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/propel-users?hl=en.


Re: How to do multiple join without foreign key (and without virtual foreign key) Ventzy Kunev 2/10/12 6:28 AM
I don't understand what you mean by "introduce myself" or "what is my
name" as I see my name before every post, as everybody else name. That
is on groups.google.com. If you receive messages by email... don't
know what you get.

Ventzy is my name, nice to meet you :)


I will try Join again as I need Criteria object and plain SQL cannot
be used in my case.



On 10 фев, 14:59, Francois Zaninotto <fzanino...@gmail.com> wrote:
> Hi [PleaseDontBerudeAndIntroduceYourselfOtherwiseIWontAnswerYouAnymore],
>
> Propel provides a low-level API for that kind of hacking. The Join object
> is there for you. Read the phpDoc, create a Join that fits your needs, and
> then add it to the Criteria.
>
> If you can't, then just write the query in SQL, execute it using PDO, then
> hydrate the objects yourself.
>
> http://www.propelorm.org/documentation/03-basic-crud.html#using_custo...
>
> Cheers,
>
> François
>
> 2012/2/10 Ventzy <v.ku...@gmail.com>
Re: How to do multiple join without foreign key (and without virtual foreign key) xplo 2/13/12 5:27 AM
hi,

there s also the possibility of doing 2 query if you want to keep the
object query method : 1 query to get the joined object you want and
put the result of the main query in an array of id ( IN clause ).

There s also a method to use a raw sql and still get the hydration of
propel ( it was one of Francois post on the blog i couldnt find it ).
Re: [propel] Re: How to do multiple join without foreign key (and without virtual foreign key) Francois Zaninotto 2/13/12 6:07 AM