Web Images Videos Maps News Shopping Google Mail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Using a join in query with no relation in schema
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
Chtipepere  
View profile   Translate to Translated (View Original)
 More options 7 July, 23:33
From: Chtipepere <chtipep...@gmail.com>
Date: Tue, 7 Jul 2009 15:33:50 -0700 (PDT)
Local: Tues 7 July 2009 23:33
Subject: Using a join in query with no relation in schema
Hi everybody,
I'm quite new to Doctrine, and I'm trying that :

return Doctrine_Query::create()
 ->select('News.*, Car.*')
 ->from('News, Car')
 ->where('News.object = ? and Car.id = News.object_id', 'Car')
 ->execute();

schema.yml:
cars:
  name:  string

news:
  title:  string
  object:  string
  objec_id: string

In the schema, there's no relation between news and car, because I
want to use news for other object (like moto for exemple), and I'm not
that good to create a behavior.

Here's the error :
"Car" with an alias of "Car" in your query does not reference the
parent component it is related to.

If anyone can help... ?

thanks in advance to everyone.

πR


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tom Boutell  
View profile   Translate to Translated (View Original)
 More options 8 July, 02:03
From: Tom Boutell <t...@punkave.com>
Date: Tue, 7 Jul 2009 21:03:53 -0400
Local: Wed 8 July 2009 02:03
Subject: Re: [doctrine-user] Using a join in query with no relation in schema
You shouldn't need a relation to do a "from with commas" implicit join
like this one. Your code would work just the way you wrote it. Except
that in your schema, cars is plural, and in your code it is singular.
You should change cars to Car in your schema.yml.

You should also be consistent about your capitalization although that
might not be a dealbreaker.

2009/7/7 Chtipepere <chtipep...@gmail.com>:

--
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
eXtreme  
View profile   Translate to Translated (View Original)
 More options 8 July, 08:55
From: eXtreme <jacek.jedrzejew...@gmail.com>
Date: Wed, 8 Jul 2009 00:55:05 -0700 (PDT)
Local: Wed 8 July 2009 08:55
Subject: Re: Using a join in query with no relation in schema
In DQL.. you should. :P

On 8 Lip, 03:03, Tom Boutell <t...@punkave.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chtipepere  
View profile   Translate to Translated (View Original)
 More options 8 July, 10:24
From: Chtipepere <chtipep...@gmail.com>
Date: Wed, 8 Jul 2009 02:24:40 -0700 (PDT)
Local: Wed 8 July 2009 10:24
Subject: Re: Using a join in query with no relation in schema
Thanks for you answer, but it didn't change anything, I still have the
same error.

eXtreme, you said "in DQL you should", should what ? need an explicit
relation in the schema ?

πR

On 8 juil, 03:03, Tom Boutell <t...@punkave.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
eXtreme  
View profile   Translate to Translated (View Original)
 More options 8 July, 15:04
From: eXtreme <jacek.jedrzejew...@gmail.com>
Date: Wed, 8 Jul 2009 07:04:42 -0700 (PDT)
Local: Wed 8 July 2009 15:04
Subject: Re: Using a join in query with no relation in schema
Yes you need a relation, in DQL comma separated "FROM Table t,
t.Relation r" means the same as "FROM Table t LEFT JOIN t.Relation r"

On 8 Lip, 11:24, Chtipepere <chtipep...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chtipepere  
View profile   Translate to Translated (View Original)
 More options 8 July, 17:09
From: Chtipepere <chtipep...@gmail.com>
Date: Wed, 8 Jul 2009 09:09:31 -0700 (PDT)
Local: Wed 8 July 2009 17:09
Subject: Re: Using a join in query with no relation in schema
So you mean I have to declare all the relations in the schema.yml ?
For every object I want to be related with an other ?
I can't do more general with object_id and object fields ?

Thanks for your answer

πR

On 8 juil, 16:04, eXtreme <jacek.jedrzejew...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
eXtreme  
View profile   Translate to Translated (View Original)
 More options 8 July, 18:21
From: eXtreme <jacek.jedrzejew...@gmail.com>
Date: Wed, 8 Jul 2009 10:21:53 -0700 (PDT)
Local: Wed 8 July 2009 18:21
Subject: Re: Using a join in query with no relation in schema
Yes, all relations in Doctrine have to be declared.

But there is a different solution for this. :P You can use table
column aggregation inheritance:
http://preview.tinyurl.com/m4fjdo

You can create a model "TypeObject" or something like this, then
create other models (like Cars, Buses, Trains whatever :P) inheriting
that TypeObject and create a relation only between TypeObject and
News. A query:

"FROM News n, n.Objects o"

will contain a news and all those extending objects (and its classes).

On 8 Lip, 18:09, Chtipepere <chtipep...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chtipepere  
View profile   Translate to Translated (View Original)
 More options 8 July, 22:02
From: Chtipepere <chtipep...@gmail.com>
Date: Wed, 8 Jul 2009 14:02:17 -0700 (PDT)
Local: Wed 8 July 2009 22:02
Subject: Re: Using a join in query with no relation in schema
So, if I've understand :

News:
  columns:
    title:  string
  relations:
    class: TypeObject
    foreignType: one

TypeObject:
  columns:
    object:  string
    object_id: string

Car:
  columns:
    name:  string
    price: string
  inheritance:
    extends: TypeObject
    type: column_aggregation
    keyField: type
    keyValue: 1

But, I think I can't have other fields in Car...
In your solution, I have to define TypeObject with all the fields that
Car, Bus and Moto should contain
e.g. for a car, we want to know if it's a cab or not, for a bus we
want to know how many people can seat in, etc...
So TypeObject should contain all these fields, because it's a generic
object. Am I right ?

If so, I'm not sure it's the right solution for my problem...

On 8 juil, 19:21, eXtreme <jacek.jedrzejew...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
eXtreme  
View profile   Translate to Translated (View Original)
 More options 9 July, 07:45
From: eXtreme <jacek.jedrzejew...@gmail.com>
Date: Wed, 8 Jul 2009 23:45:17 -0700 (PDT)
Local: Thurs 9 July 2009 07:45
Subject: Re: Using a join in query with no relation in schema
You can have additional fields in "Car", as in your example code.

News:
  columns:
    title:  string
    object_id: integer
  relations:
    Object:
      class: TypeObject
      local: object_id
      foreign: id
      foreignType: one

TypeObject:
  columns:
    name:  string
    price: float

Car:
  inheritance:
    extends: TypeObject
    type: column_aggregation
    keyField: type
    keyValue: car
  columns:
    is_cab: boolean

Bus:
  inheritance:
    extends: TypeObject
    type: column_aggregation
    keyField: type
    keyValue: bus
  columns:
    seat_count: integer

Moto:
  inheritance:
    extends: TypeObject
    type: column_aggregation
    keyField: type
    keyValue: moto
  columns:
    horsepower: integer

On 8 Lip, 23:02, Chtipepere <chtipep...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chtipepere  
View profile   Translate to Translated (View Original)
 More options 9 July, 14:57
From: Chtipepere <chtipep...@gmail.com>
Date: Thu, 9 Jul 2009 06:57:19 -0700 (PDT)
Local: Thurs 9 July 2009 14:57
Subject: Re: Using a join in query with no relation in schema
So it means there will be tables for cars, buses, etc... ?

On 9 juil, 08:45, eXtreme <jacek.jedrzejew...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
eXtreme  
View profile   Translate to Translated (View Original)
 More options 9 July, 15:16
From: eXtreme <jacek.jedrzejew...@gmail.com>
Date: Thu, 9 Jul 2009 07:16:48 -0700 (PDT)
Local: Thurs 9 July 2009 15:16
Subject: Re: Using a join in query with no relation in schema
No... not in the DB. This is characteristic of column aggregation. But
you still have model classes and they don't share columns. DB is
behind Doctrine.

On 9 Lip, 15:57, Chtipepere <chtipep...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google