i encountered a problem, when using a left join command in a query.
Basically, what happened is that my joined results were not appearing
in the final results of the query. After carefully testing the
validity of the actual query (by testing the query to mysql directly)
i realized that the problem can not originate from mysql as such.
A few details:
Model A:
Consists of an (primary key) 'id' of type string, length 16
and a few other fields, most importantly for this example a field
'code' (string/10)
Model B:
Has a field 'mandantPath' that is related to model A (field id)
through a hasOne() relation.
#code
$this->hasOne('mandant_db_node as mandant', array
('local'=>'mandantPath','foreign'=>'id'));
Now, if i call this the way i do (above), i get the basic results
(fields), but not the joined ones. If i get the SQL query generated by
Doctrine, and use it directly, it works just fine and it returns the
'code' field as it should.
However, when i add type Doctrine::HYDRATE_ARRAY to the execute
command, i get the correct results, but of course encapsuled.. so that
i have to loop/parse through the result and set the values according
to my demands.
Pretty frustrating - while i am certain that the problem is very basic
and i just lack the knowledge of a proper solution. Hopefully someone
in here knows what i am dealing with - specifically, what it is that i
am doing wrong.
On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> Hello there,
> i encountered a problem, when using a left join command in a query.
> Basically, what happened is that my joined results were not appearing
> in the final results of the query. After carefully testing the
> validity of the actual query (by testing the query to mysql directly)
> i realized that the problem can not originate from mysql as such.
> A few details:
> Model A:
> Consists of an (primary key) 'id' of type string, length 16
> and a few other fields, most importantly for this example a field
> 'code' (string/10)
> Model B:
> Has a field 'mandantPath' that is related to model A (field id)
> through a hasOne() relation.
> #code
> $this->hasOne('mandant_db_node as mandant', array
> ('local'=>'mandantPath','foreign'=>'id'));
> Now, if i call this the way i do (above), i get the basic results
> (fields), but not the joined ones. If i get the SQL query generated by
> Doctrine, and use it directly, it works just fine and it returns the
> 'code' field as it should.
> However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> command, i get the correct results, but of course encapsuled.. so that
> i have to loop/parse through the result and set the values according
> to my demands.
> Pretty frustrating - while i am certain that the problem is very basic
> and i just lack the knowledge of a proper solution. Hopefully someone
> in here knows what i am dealing with - specifically, what it is that i
> am doing wrong.
> Kind regards, James
-- Jonathan H. Wage (+1 415 992 5468)
Open Source Software Developer & Evangelist
sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
You can contact Jonathan about Doctrine, Symfony and Open-Source or for
training, consulting, application development, or business related questions
at jonathan.w...@sensio.com
> I think it is because you are not selecting enough data from the cc alias.
> Try just changing it to a wide open select by removing the select() line.
> - Jon
> On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > Hello there,
> > i encountered a problem, when using a left join command in a query.
> > Basically, what happened is that my joined results were not appearing
> > in the final results of the query. After carefully testing the
> > validity of the actual query (by testing the query to mysql directly)
> > i realized that the problem can not originate from mysql as such.
> > A few details:
> > Model A:
> > Consists of an (primary key) 'id' of type string, length 16
> > and a few other fields, most importantly for this example a field
> > 'code' (string/10)
> > Model B:
> > Has a field 'mandantPath' that is related to model A (field id)
> > through a hasOne() relation.
> > Now, if i call this the way i do (above), i get the basic results
> > (fields), but not the joined ones. If i get the SQL query generated by
> > Doctrine, and use it directly, it works just fine and it returns the
> > 'code' field as it should.
> > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > command, i get the correct results, but of course encapsuled.. so that
> > i have to loop/parse through the result and set the values according
> > to my demands.
> > Pretty frustrating - while i am certain that the problem is very basic
> > and i just lack the knowledge of a proper solution. Hopefully someone
> > in here knows what i am dealing with - specifically, what it is that i
> > am doing wrong.
> > Kind regards, James
> --
> Jonathan H. Wage (+1 415 992 5468)
> Open Source Software Developer & Evangelist
> sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
> You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> training, consulting, application development, or business related questions
> at jonathan.w...@sensio.com
> i tried it, without select, but the results were exactly the same.
> Does anyone know what is going wrong here?
> On 8 Jul., 20:20, Jonathan Wage <jonw...@gmail.com> wrote:
> > I think it is because you are not selecting enough data from the cc alias.
> > Try just changing it to a wide open select by removing the select() line.
> > - Jon
> > On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > > Hello there,
> > > i encountered a problem, when using a left join command in a query.
> > > Basically, what happened is that my joined results were not appearing
> > > in the final results of the query. After carefully testing the
> > > validity of the actual query (by testing the query to mysql directly)
> > > i realized that the problem can not originate from mysql as such.
> > > A few details:
> > > Model A:
> > > Consists of an (primary key) 'id' of type string, length 16
> > > and a few other fields, most importantly for this example a field
> > > 'code' (string/10)
> > > Model B:
> > > Has a field 'mandantPath' that is related to model A (field id)
> > > through a hasOne() relation.
> > > Now, if i call this the way i do (above), i get the basic results
> > > (fields), but not the joined ones. If i get the SQL query generated by
> > > Doctrine, and use it directly, it works just fine and it returns the
> > > 'code' field as it should.
> > > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > > command, i get the correct results, but of course encapsuled.. so that
> > > i have to loop/parse through the result and set the values according
> > > to my demands.
> > > Pretty frustrating - while i am certain that the problem is very basic
> > > and i just lack the knowledge of a proper solution. Hopefully someone
> > > in here knows what i am dealing with - specifically, what it is that i
> > > am doing wrong.
> > > Kind regards, James
> > --
> > Jonathan H. Wage (+1 415 992 5468)
> > Open Source Software Developer & Evangelist
> > sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
> > You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> > training, consulting, application development, or business related questions
> > at jonathan.w...@sensio.com
> How do you check your result? With toArray() method?
> On 9 Lip, 11:19, James Tucker <tenlet...@gmail.com> wrote:
> > Thank you for the hint,
> > i tried it, without select, but the results were exactly the same.
> > Does anyone know what is going wrong here?
> > On 8 Jul., 20:20, Jonathan Wage <jonw...@gmail.com> wrote:
> > > I think it is because you are not selecting enough data from the cc alias.
> > > Try just changing it to a wide open select by removing the select() line.
> > > - Jon
> > > On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > > > Hello there,
> > > > i encountered a problem, when using a left join command in a query.
> > > > Basically, what happened is that my joined results were not appearing
> > > > in the final results of the query. After carefully testing the
> > > > validity of the actual query (by testing the query to mysql directly)
> > > > i realized that the problem can not originate from mysql as such.
> > > > A few details:
> > > > Model A:
> > > > Consists of an (primary key) 'id' of type string, length 16
> > > > and a few other fields, most importantly for this example a field
> > > > 'code' (string/10)
> > > > Model B:
> > > > Has a field 'mandantPath' that is related to model A (field id)
> > > > through a hasOne() relation.
> > > > Now, if i call this the way i do (above), i get the basic results
> > > > (fields), but not the joined ones. If i get the SQL query generated by
> > > > Doctrine, and use it directly, it works just fine and it returns the
> > > > 'code' field as it should.
> > > > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > > > command, i get the correct results, but of course encapsuled.. so that
> > > > i have to loop/parse through the result and set the values according
> > > > to my demands.
> > > > Pretty frustrating - while i am certain that the problem is very basic
> > > > and i just lack the knowledge of a proper solution. Hopefully someone
> > > > in here knows what i am dealing with - specifically, what it is that i
> > > > am doing wrong.
> > > You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> > > training, consulting, application development, or business related questions
> > > at jonathan.w...@sensio.com
> Yes, definately. Is that not the correct way to deal with this?
> On 9 Jul., 11:45, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > How do you check your result? With toArray() method?
> > On 9 Lip, 11:19, James Tucker <tenlet...@gmail.com> wrote:
> > > Thank you for the hint,
> > > i tried it, without select, but the results were exactly the same.
> > > Does anyone know what is going wrong here?
> > > On 8 Jul., 20:20, Jonathan Wage <jonw...@gmail.com> wrote:
> > > > I think it is because you are not selecting enough data from the cc alias.
> > > > Try just changing it to a wide open select by removing the select() line.
> > > > - Jon
> > > > On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > > > > Hello there,
> > > > > i encountered a problem, when using a left join command in a query.
> > > > > Basically, what happened is that my joined results were not appearing
> > > > > in the final results of the query. After carefully testing the
> > > > > validity of the actual query (by testing the query to mysql directly)
> > > > > i realized that the problem can not originate from mysql as such.
> > > > > A few details:
> > > > > Model A:
> > > > > Consists of an (primary key) 'id' of type string, length 16
> > > > > and a few other fields, most importantly for this example a field
> > > > > 'code' (string/10)
> > > > > Model B:
> > > > > Has a field 'mandantPath' that is related to model A (field id)
> > > > > through a hasOne() relation.
> > > > > Now, if i call this the way i do (above), i get the basic results
> > > > > (fields), but not the joined ones. If i get the SQL query generated by
> > > > > Doctrine, and use it directly, it works just fine and it returns the
> > > > > 'code' field as it should.
> > > > > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > > > > command, i get the correct results, but of course encapsuled.. so that
> > > > > i have to loop/parse through the result and set the values according
> > > > > to my demands.
> > > > > Pretty frustrating - while i am certain that the problem is very basic
> > > > > and i just lack the knowledge of a proper solution. Hopefully someone
> > > > > in here knows what i am dealing with - specifically, what it is that i
> > > > > am doing wrong.
> > > > You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> > > > training, consulting, application development, or business related questions
> > > > at jonathan.w...@sensio.com
> It is good, but do you pass "true" argument to that method? I mean -
> >toArray(true) - it prints the array with relations.
> On 9 Lip, 11:50, James Tucker <tenlet...@gmail.com> wrote:
> > Yes, definately. Is that not the correct way to deal with this?
> > On 9 Jul., 11:45, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > > How do you check your result? With toArray() method?
> > > On 9 Lip, 11:19, James Tucker <tenlet...@gmail.com> wrote:
> > > > Thank you for the hint,
> > > > i tried it, without select, but the results were exactly the same.
> > > > Does anyone know what is going wrong here?
> > > > On 8 Jul., 20:20, Jonathan Wage <jonw...@gmail.com> wrote:
> > > > > I think it is because you are not selecting enough data from the cc alias.
> > > > > Try just changing it to a wide open select by removing the select() line.
> > > > > - Jon
> > > > > On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > Hello there,
> > > > > > i encountered a problem, when using a left join command in a query.
> > > > > > Basically, what happened is that my joined results were not appearing
> > > > > > in the final results of the query. After carefully testing the
> > > > > > validity of the actual query (by testing the query to mysql directly)
> > > > > > i realized that the problem can not originate from mysql as such.
> > > > > > A few details:
> > > > > > Model A:
> > > > > > Consists of an (primary key) 'id' of type string, length 16
> > > > > > and a few other fields, most importantly for this example a field
> > > > > > 'code' (string/10)
> > > > > > Model B:
> > > > > > Has a field 'mandantPath' that is related to model A (field id)
> > > > > > through a hasOne() relation.
> > > > > > Now, if i call this the way i do (above), i get the basic results
> > > > > > (fields), but not the joined ones. If i get the SQL query generated by
> > > > > > Doctrine, and use it directly, it works just fine and it returns the
> > > > > > 'code' field as it should.
> > > > > > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > > > > > command, i get the correct results, but of course encapsuled.. so that
> > > > > > i have to loop/parse through the result and set the values according
> > > > > > to my demands.
> > > > > > Pretty frustrating - while i am certain that the problem is very basic
> > > > > > and i just lack the knowledge of a proper solution. Hopefully someone
> > > > > > in here knows what i am dealing with - specifically, what it is that i
> > > > > > am doing wrong.
> > > > > You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> > > > > training, consulting, application development, or business related questions
> > > > > at jonathan.w...@sensio.com
Okay, swift me.. it actually works, indeed, but i have another problem
coming up:
The result is encapsuled. Which means, i do now get the joined
results, but i have to parse through them and set them to the main
array level, in order to be able to return a simple one-levelled
array / listing. I do not understand this, since i also request p.code
in my select query, but still i get no field "code" with the desired
value.
However, when i set out the SQL query directly, i get returned a
column code with the appropriate values. Thus, again, this must be
something i didnt see in Doctrine.
Does anyone know the solution to this?
On 9 Jul., 12:10, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> It is good, but do you pass "true" argument to that method? I mean -
> >toArray(true) - it prints the array with relations.
> On 9 Lip, 11:50, James Tucker <tenlet...@gmail.com> wrote:
> > Yes, definately. Is that not the correct way to deal with this?
> > On 9 Jul., 11:45, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > > How do you check your result? With toArray() method?
> > > On 9 Lip, 11:19, James Tucker <tenlet...@gmail.com> wrote:
> > > > Thank you for the hint,
> > > > i tried it, without select, but the results were exactly the same.
> > > > Does anyone know what is going wrong here?
> > > > On 8 Jul., 20:20, Jonathan Wage <jonw...@gmail.com> wrote:
> > > > > I think it is because you are not selecting enough data from the cc alias.
> > > > > Try just changing it to a wide open select by removing the select() line.
> > > > > - Jon
> > > > > On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > Hello there,
> > > > > > i encountered a problem, when using a left join command in a query.
> > > > > > Basically, what happened is that my joined results were not appearing
> > > > > > in the final results of the query. After carefully testing the
> > > > > > validity of the actual query (by testing the query to mysql directly)
> > > > > > i realized that the problem can not originate from mysql as such.
> > > > > > A few details:
> > > > > > Model A:
> > > > > > Consists of an (primary key) 'id' of type string, length 16
> > > > > > and a few other fields, most importantly for this example a field
> > > > > > 'code' (string/10)
> > > > > > Model B:
> > > > > > Has a field 'mandantPath' that is related to model A (field id)
> > > > > > through a hasOne() relation.
> > > > > > Now, if i call this the way i do (above), i get the basic results
> > > > > > (fields), but not the joined ones. If i get the SQL query generated by
> > > > > > Doctrine, and use it directly, it works just fine and it returns the
> > > > > > 'code' field as it should.
> > > > > > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > > > > > command, i get the correct results, but of course encapsuled.. so that
> > > > > > i have to loop/parse through the result and set the values according
> > > > > > to my demands.
> > > > > > Pretty frustrating - while i am certain that the problem is very basic
> > > > > > and i just lack the knowledge of a proper solution. Hopefully someone
> > > > > > in here knows what i am dealing with - specifically, what it is that i
> > > > > > am doing wrong.
> > > > > You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> > > > > training, consulting, application development, or business related questions
> > > > > at jonathan.w...@sensio.com
> Okay, swift me.. it actually works, indeed, but i have another problem
> coming up:
> The result is encapsuled. Which means, i do now get the joined
> results, but i have to parse through them and set them to the main
> array level, in order to be able to return a simple one-levelled
> array / listing. I do not understand this, since i also request p.code
> in my select query, but still i get no field "code" with the desired
> value.
> However, when i set out the SQL query directly, i get returned a
> column code with the appropriate values. Thus, again, this must be
> something i didnt see in Doctrine.
> Does anyone know the solution to this?
> On 9 Jul., 12:10, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > It is good, but do you pass "true" argument to that method? I mean -
> > >toArray(true) - it prints the array with relations.
> > On 9 Lip, 11:50, James Tucker <tenlet...@gmail.com> wrote:
> > > Yes, definately. Is that not the correct way to deal with this?
> > > On 9 Jul., 11:45, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > > > How do you check your result? With toArray() method?
> > > > On 9 Lip, 11:19, James Tucker <tenlet...@gmail.com> wrote:
> > > > > Thank you for the hint,
> > > > > i tried it, without select, but the results were exactly the same.
> > > > > Does anyone know what is going wrong here?
> > > > > On 8 Jul., 20:20, Jonathan Wage <jonw...@gmail.com> wrote:
> > > > > > I think it is because you are not selecting enough data from the cc alias.
> > > > > > Try just changing it to a wide open select by removing the select() line.
> > > > > > - Jon
> > > > > > On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > Hello there,
> > > > > > > i encountered a problem, when using a left join command in a query.
> > > > > > > Basically, what happened is that my joined results were not appearing
> > > > > > > in the final results of the query. After carefully testing the
> > > > > > > validity of the actual query (by testing the query to mysql directly)
> > > > > > > i realized that the problem can not originate from mysql as such.
> > > > > > > A few details:
> > > > > > > Model A:
> > > > > > > Consists of an (primary key) 'id' of type string, length 16
> > > > > > > and a few other fields, most importantly for this example a field
> > > > > > > 'code' (string/10)
> > > > > > > Model B:
> > > > > > > Has a field 'mandantPath' that is related to model A (field id)
> > > > > > > through a hasOne() relation.
> > > > > > > Now, if i call this the way i do (above), i get the basic results
> > > > > > > (fields), but not the joined ones. If i get the SQL query generated by
> > > > > > > Doctrine, and use it directly, it works just fine and it returns the
> > > > > > > 'code' field as it should.
> > > > > > > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > > > > > > command, i get the correct results, but of course encapsuled.. so that
> > > > > > > i have to loop/parse through the result and set the values according
> > > > > > > to my demands.
> > > > > > > Pretty frustrating - while i am certain that the problem is very basic
> > > > > > > and i just lack the knowledge of a proper solution. Hopefully someone
> > > > > > > in here knows what i am dealing with - specifically, what it is that i
> > > > > > > am doing wrong.
> > > > > > You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> > > > > > training, consulting, application development, or business related questions
> > > > > > at jonathan.w...@sensio.com
Thank you. I do have trouble with this documentation, for i fail to
find what i look for. Anyway, your link basically helped me find the
correct topic, but the problem persists, for none of the optional
hydration modes will give me the results i need.
HYDRATION_NONE is the one coming closest, because it returns to me the
exact selection from my query in one single array level, but then
again it does not include the keys (field names).
I have tried all hydration modes, but i just can't find the correct
solution.
I carefully and kindly ask for help here again, after having gone
through the documentational part in detaIl.
On 9 Jul., 16:47, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> On 9 Lip, 14:55, James Tucker <tenlet...@gmail.com> wrote:
> > Okay, swift me.. it actually works, indeed, but i have another problem
> > coming up:
> > The result is encapsuled. Which means, i do now get the joined
> > results, but i have to parse through them and set them to the main
> > array level, in order to be able to return a simple one-levelled
> > array / listing. I do not understand this, since i also request p.code
> > in my select query, but still i get no field "code" with the desired
> > value.
> > However, when i set out the SQL query directly, i get returned a
> > column code with the appropriate values. Thus, again, this must be
> > something i didnt see in Doctrine.
> > Does anyone know the solution to this?
> > On 9 Jul., 12:10, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > > It is good, but do you pass "true" argument to that method? I mean -
> > > >toArray(true) - it prints the array with relations.
> > > On 9 Lip, 11:50, James Tucker <tenlet...@gmail.com> wrote:
> > > > Yes, definately. Is that not the correct way to deal with this?
> > > > > How do you check your result? With toArray() method?
> > > > > On 9 Lip, 11:19, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > Thank you for the hint,
> > > > > > i tried it, without select, but the results were exactly the same.
> > > > > > Does anyone know what is going wrong here?
> > > > > > On 8 Jul., 20:20, Jonathan Wage <jonw...@gmail.com> wrote:
> > > > > > > I think it is because you are not selecting enough data from the cc alias.
> > > > > > > Try just changing it to a wide open select by removing the select() line.
> > > > > > > - Jon
> > > > > > > On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > > Hello there,
> > > > > > > > i encountered a problem, when using a left join command in a query.
> > > > > > > > Basically, what happened is that my joined results were not appearing
> > > > > > > > in the final results of the query. After carefully testing the
> > > > > > > > validity of the actual query (by testing the query to mysql directly)
> > > > > > > > i realized that the problem can not originate from mysql as such.
> > > > > > > > A few details:
> > > > > > > > Model A:
> > > > > > > > Consists of an (primary key) 'id' of type string, length 16
> > > > > > > > and a few other fields, most importantly for this example a field
> > > > > > > > 'code' (string/10)
> > > > > > > > Model B:
> > > > > > > > Has a field 'mandantPath' that is related to model A (field id)
> > > > > > > > through a hasOne() relation.
> > > > > > > > Now, if i call this the way i do (above), i get the basic results
> > > > > > > > (fields), but not the joined ones. If i get the SQL query generated by
> > > > > > > > Doctrine, and use it directly, it works just fine and it returns the
> > > > > > > > 'code' field as it should.
> > > > > > > > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > > > > > > > command, i get the correct results, but of course encapsuled.. so that
> > > > > > > > i have to loop/parse through the result and set the values according
> > > > > > > > to my demands.
> > > > > > > > Pretty frustrating - while i am certain that the problem is very basic
> > > > > > > > and i just lack the knowledge of a proper solution. Hopefully someone
> > > > > > > > in here knows what i am dealing with - specifically, what it is that i
> > > > > > > > am doing wrong.
> > > > > > > You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> > > > > > > training, consulting, application development, or business related questions
> > > > > > > at jonathan.w...@sensio.com
> Thank you. I do have trouble with this documentation, for i fail to
> find what i look for. Anyway, your link basically helped me find the
> correct topic, but the problem persists, for none of the optional
> hydration modes will give me the results i need.
> HYDRATION_NONE is the one coming closest, because it returns to me the
> exact selection from my query in one single array level, but then
> again it does not include the keys (field names).
> I have tried all hydration modes, but i just can't find the correct
> solution.
> I carefully and kindly ask for help here again, after having gone
> through the documentational part in detaIl.
> On 9 Jul., 16:47, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > James, these are the basis of working with doctrine..
> > On 9 Lip, 14:55, James Tucker <tenlet...@gmail.com> wrote:
> > > Okay, swift me.. it actually works, indeed, but i have another problem
> > > coming up:
> > > The result is encapsuled. Which means, i do now get the joined
> > > results, but i have to parse through them and set them to the main
> > > array level, in order to be able to return a simple one-levelled
> > > array / listing. I do not understand this, since i also request p.code
> > > in my select query, but still i get no field "code" with the desired
> > > value.
> > > However, when i set out the SQL query directly, i get returned a
> > > column code with the appropriate values. Thus, again, this must be
> > > something i didnt see in Doctrine.
> > > Does anyone know the solution to this?
> > > On 9 Jul., 12:10, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > > > It is good, but do you pass "true" argument to that method? I mean -
> > > > >toArray(true) - it prints the array with relations.
> > > > On 9 Lip, 11:50, James Tucker <tenlet...@gmail.com> wrote:
> > > > > Yes, definately. Is that not the correct way to deal with this?
> > > > > > How do you check your result? With toArray() method?
> > > > > > On 9 Lip, 11:19, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > Thank you for the hint,
> > > > > > > i tried it, without select, but the results were exactly the same.
> > > > > > > Does anyone know what is going wrong here?
> > > > > > > On 8 Jul., 20:20, Jonathan Wage <jonw...@gmail.com> wrote:
> > > > > > > > I think it is because you are not selecting enough data from the cc alias.
> > > > > > > > Try just changing it to a wide open select by removing the select() line.
> > > > > > > > - Jon
> > > > > > > > On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > > > Hello there,
> > > > > > > > > i encountered a problem, when using a left join command in a query.
> > > > > > > > > Basically, what happened is that my joined results were not appearing
> > > > > > > > > in the final results of the query. After carefully testing the
> > > > > > > > > validity of the actual query (by testing the query to mysql directly)
> > > > > > > > > i realized that the problem can not originate from mysql as such.
> > > > > > > > > A few details:
> > > > > > > > > Model A:
> > > > > > > > > Consists of an (primary key) 'id' of type string, length 16
> > > > > > > > > and a few other fields, most importantly for this example a field
> > > > > > > > > 'code' (string/10)
> > > > > > > > > Model B:
> > > > > > > > > Has a field 'mandantPath' that is related to model A (field id)
> > > > > > > > > through a hasOne() relation.
> > > > > > > > > Now, if i call this the way i do (above), i get the basic results
> > > > > > > > > (fields), but not the joined ones. If i get the SQL query generated by
> > > > > > > > > Doctrine, and use it directly, it works just fine and it returns the
> > > > > > > > > 'code' field as it should.
> > > > > > > > > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > > > > > > > > command, i get the correct results, but of course encapsuled.. so that
> > > > > > > > > i have to loop/parse through the result and set the values according
> > > > > > > > > to my demands.
> > > > > > > > > Pretty frustrating - while i am certain that the problem is very basic
> > > > > > > > > and i just lack the knowledge of a proper solution. Hopefully someone
> > > > > > > > > in here knows what i am dealing with - specifically, what it is that i
> > > > > > > > > am doing wrong.
> > > > > > > > You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> > > > > > > > training, consulting, application development, or business related questions
> > > > > > > > at jonathan.w...@sensio.com
That's correct. I have tried it, but discarded it because i can't make
use of the column names with the prefixes. There must be a way to get
just a flat array with the very basic field names from the table /
select plus joins?
On 10 Jul., 12:47, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> Have you tried HYDRATE_SCALAR? It gives you a flat resultset like you
> want but with column names prefixed with table aliases from query.
> On 10 Lip, 12:44, James Tucker <tenlet...@gmail.com> wrote:
> > Thank you. I do have trouble with this documentation, for i fail to
> > find what i look for. Anyway, your link basically helped me find the
> > correct topic, but the problem persists, for none of the optional
> > hydration modes will give me the results i need.
> > HYDRATION_NONE is the one coming closest, because it returns to me the
> > exact selection from my query in one single array level, but then
> > again it does not include the keys (field names).
> > I have tried all hydration modes, but i just can't find the correct
> > solution.
> > I carefully and kindly ask for help here again, after having gone
> > through the documentational part in detaIl.
> > On 9 Jul., 16:47, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > > James, these are the basis of working with doctrine..
> > > On 9 Lip, 14:55, James Tucker <tenlet...@gmail.com> wrote:
> > > > Okay, swift me.. it actually works, indeed, but i have another problem
> > > > coming up:
> > > > The result is encapsuled. Which means, i do now get the joined
> > > > results, but i have to parse through them and set them to the main
> > > > array level, in order to be able to return a simple one-levelled
> > > > array / listing. I do not understand this, since i also request p.code
> > > > in my select query, but still i get no field "code" with the desired
> > > > value.
> > > > However, when i set out the SQL query directly, i get returned a
> > > > column code with the appropriate values. Thus, again, this must be
> > > > something i didnt see in Doctrine.
> > > > > > > How do you check your result? With toArray() method?
> > > > > > > On 9 Lip, 11:19, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > > Thank you for the hint,
> > > > > > > > i tried it, without select, but the results were exactly the same.
> > > > > > > > Does anyone know what is going wrong here?
> > > > > > > > On 8 Jul., 20:20, Jonathan Wage <jonw...@gmail.com> wrote:
> > > > > > > > > I think it is because you are not selecting enough data from the cc alias.
> > > > > > > > > Try just changing it to a wide open select by removing the select() line.
> > > > > > > > > - Jon
> > > > > > > > > On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > > > > Hello there,
> > > > > > > > > > i encountered a problem, when using a left join command in a query.
> > > > > > > > > > Basically, what happened is that my joined results were not appearing
> > > > > > > > > > in the final results of the query. After carefully testing the
> > > > > > > > > > validity of the actual query (by testing the query to mysql directly)
> > > > > > > > > > i realized that the problem can not originate from mysql as such.
> > > > > > > > > > A few details:
> > > > > > > > > > Model A:
> > > > > > > > > > Consists of an (primary key) 'id' of type string, length 16
> > > > > > > > > > and a few other fields, most importantly for this example a field
> > > > > > > > > > 'code' (string/10)
> > > > > > > > > > Model B:
> > > > > > > > > > Has a field 'mandantPath' that is related to model A (field id)
> > > > > > > > > > through a hasOne() relation.
> > > > > > > > > > Now, if i call this the way i do (above), i get the basic results
> > > > > > > > > > (fields), but not the joined ones. If i get the SQL query generated by
> > > > > > > > > > Doctrine, and use it directly, it works just fine and it returns the
> > > > > > > > > > 'code' field as it should.
> > > > > > > > > > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > > > > > > > > > command, i get the correct results, but of course encapsuled.. so that
> > > > > > > > > > i have to loop/parse through the result and set the values according
> > > > > > > > > > to my demands.
> > > > > > > > > > Pretty frustrating - while i am certain that the problem is very basic
> > > > > > > > > > and i just lack the knowledge of a proper solution. Hopefully someone
> > > > > > > > > > in here knows what i am dealing with - specifically, what it is that i
> > > > > > > > > > am doing wrong.
> > > > > > > > > You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> > > > > > > > > training, consulting, application development, or business related questions
> > > > > > > > > at jonathan.w...@sensio.com
"However, in order to avoid ambiguities between field names all field
names in the result set are prefixed with the DQL alias that you
specified in the query."
They are there to avoid possible conflicts between field names. And
SCALAR is that "flat array with the very basic field names". :P There
is no other option. Either NONE or SCALAR, you must choose. :P
Custom hydrations are introduced in 1.2 branch.
On 10 Lip, 13:00, James Tucker <tenlet...@gmail.com> wrote:
> That's correct. I have tried it, but discarded it because i can't make
> use of the column names with the prefixes. There must be a way to get
> just a flat array with the very basic field names from the table /
> select plus joins?
> On 10 Jul., 12:47, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > Have you tried HYDRATE_SCALAR? It gives you a flat resultset like you
> > want but with column names prefixed with table aliases from query.
> > On 10 Lip, 12:44, James Tucker <tenlet...@gmail.com> wrote:
> > > Thank you. I do have trouble with this documentation, for i fail to
> > > find what i look for. Anyway, your link basically helped me find the
> > > correct topic, but the problem persists, for none of the optional
> > > hydration modes will give me the results i need.
> > > HYDRATION_NONE is the one coming closest, because it returns to me the
> > > exact selection from my query in one single array level, but then
> > > again it does not include the keys (field names).
> > > I have tried all hydration modes, but i just can't find the correct
> > > solution.
> > > I carefully and kindly ask for help here again, after having gone
> > > through the documentational part in detaIl.
> > > On 9 Jul., 16:47, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > > > James, these are the basis of working with doctrine..
> > > > On 9 Lip, 14:55, James Tucker <tenlet...@gmail.com> wrote:
> > > > > Okay, swift me.. it actually works, indeed, but i have another problem
> > > > > coming up:
> > > > > The result is encapsuled. Which means, i do now get the joined
> > > > > results, but i have to parse through them and set them to the main
> > > > > array level, in order to be able to return a simple one-levelled
> > > > > array / listing. I do not understand this, since i also request p.code
> > > > > in my select query, but still i get no field "code" with the desired
> > > > > value.
> > > > > However, when i set out the SQL query directly, i get returned a
> > > > > column code with the appropriate values. Thus, again, this must be
> > > > > something i didnt see in Doctrine.
> > > > > > > > How do you check your result? With toArray() method?
> > > > > > > > On 9 Lip, 11:19, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > > > Thank you for the hint,
> > > > > > > > > i tried it, without select, but the results were exactly the same.
> > > > > > > > > Does anyone know what is going wrong here?
> > > > > > > > > On 8 Jul., 20:20, Jonathan Wage <jonw...@gmail.com> wrote:
> > > > > > > > > > I think it is because you are not selecting enough data from the cc alias.
> > > > > > > > > > Try just changing it to a wide open select by removing the select() line.
> > > > > > > > > > - Jon
> > > > > > > > > > On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > > > > > Hello there,
> > > > > > > > > > > i encountered a problem, when using a left join command in a query.
> > > > > > > > > > > Basically, what happened is that my joined results were not appearing
> > > > > > > > > > > in the final results of the query. After carefully testing the
> > > > > > > > > > > validity of the actual query (by testing the query to mysql directly)
> > > > > > > > > > > i realized that the problem can not originate from mysql as such.
> > > > > > > > > > > A few details:
> > > > > > > > > > > Model A:
> > > > > > > > > > > Consists of an (primary key) 'id' of type string, length 16
> > > > > > > > > > > and a few other fields, most importantly for this example a field
> > > > > > > > > > > 'code' (string/10)
> > > > > > > > > > > Model B:
> > > > > > > > > > > Has a field 'mandantPath' that is related to model A (field id)
> > > > > > > > > > > through a hasOne() relation.
> > > > > > > > > > > Now, if i call this the way i do (above), i get the basic results
> > > > > > > > > > > (fields), but not the joined ones. If i get the SQL query generated by
> > > > > > > > > > > Doctrine, and use it directly, it works just fine and it returns the
> > > > > > > > > > > 'code' field as it should.
> > > > > > > > > > > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > > > > > > > > > > command, i get the correct results, but of course encapsuled.. so that
> > > > > > > > > > > i have to loop/parse through the result and set the values according
> > > > > > > > > > > to my demands.
> > > > > > > > > > > Pretty frustrating - while i am certain that the problem is very basic
> > > > > > > > > > > and i just lack the knowledge of a proper solution. Hopefully someone
> > > > > > > > > > > in here knows what i am dealing with - specifically, what it is that i
> > > > > > > > > > > am doing wrong.
> > > > > > > > > > You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> > > > > > > > > > training, consulting, application development, or business related questions
> > > > > > > > > > at jonathan.w...@sensio.com
Interesting point. Makes sense. Regarding my coding situation i find
it disturbing, because i actually deal with the option of conflict
myself, thus preventing it. But well, as you say, custom hydrations
coming up.
For the sake of completeness:
When i set my query manually in terminal / mysql client, i get my
result set,.. it does not struggle with "potential conflicts" and
other problems alike - i just get my list and the field names are
perfect. That is why i thought it must be possible to get this from
doctrine too. Now instead of making a simple doctrine query, i have to
walk through the results and delevel them each time.
I yield to thee - in any case, for your patience and your willingness
to help!
On 10 Jul., 13:16, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> "However, in order to avoid ambiguities between field names all field
> names in the result set are prefixed with the DQL alias that you
> specified in the query."
> They are there to avoid possible conflicts between field names. And
> SCALAR is that "flat array with the very basic field names". :P There
> is no other option. Either NONE or SCALAR, you must choose. :P
> Custom hydrations are introduced in 1.2 branch.
> On 10 Lip, 13:00, James Tucker <tenlet...@gmail.com> wrote:
> > That's correct. I have tried it, but discarded it because i can't make
> > use of the column names with the prefixes. There must be a way to get
> > just a flat array with the very basic field names from the table /
> > select plus joins?
> > On 10 Jul., 12:47, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > > Have you tried HYDRATE_SCALAR? It gives you a flat resultset like you
> > > want but with column names prefixed with table aliases from query.
> > > On 10 Lip, 12:44, James Tucker <tenlet...@gmail.com> wrote:
> > > > Thank you. I do have trouble with this documentation, for i fail to
> > > > find what i look for. Anyway, your link basically helped me find the
> > > > correct topic, but the problem persists, for none of the optional
> > > > hydration modes will give me the results i need.
> > > > HYDRATION_NONE is the one coming closest, because it returns to me the
> > > > exact selection from my query in one single array level, but then
> > > > again it does not include the keys (field names).
> > > > I have tried all hydration modes, but i just can't find the correct
> > > > solution.
> > > > I carefully and kindly ask for help here again, after having gone
> > > > through the documentational part in detaIl.
> > > > > On 9 Lip, 14:55, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > Okay, swift me.. it actually works, indeed, but i have another problem
> > > > > > coming up:
> > > > > > The result is encapsuled. Which means, i do now get the joined
> > > > > > results, but i have to parse through them and set them to the main
> > > > > > array level, in order to be able to return a simple one-levelled
> > > > > > array / listing. I do not understand this, since i also request p.code
> > > > > > in my select query, but still i get no field "code" with the desired
> > > > > > value.
> > > > > > However, when i set out the SQL query directly, i get returned a
> > > > > > column code with the appropriate values. Thus, again, this must be
> > > > > > something i didnt see in Doctrine.
> > > > > > Does anyone know the solution to this?
> > > > > > > > > How do you check your result? With toArray() method?
> > > > > > > > > On 9 Lip, 11:19, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > > > > Thank you for the hint,
> > > > > > > > > > i tried it, without select, but the results were exactly the same.
> > > > > > > > > > Does anyone know what is going wrong here?
> > > > > > > > > > On 8 Jul., 20:20, Jonathan Wage <jonw...@gmail.com> wrote:
> > > > > > > > > > > I think it is because you are not selecting enough data from the cc alias.
> > > > > > > > > > > Try just changing it to a wide open select by removing the select() line.
> > > > > > > > > > > - Jon
> > > > > > > > > > > On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > > > > > > Hello there,
> > > > > > > > > > > > i encountered a problem, when using a left join command in a query.
> > > > > > > > > > > > Basically, what happened is that my joined results were not appearing
> > > > > > > > > > > > in the final results of the query. After carefully testing the
> > > > > > > > > > > > validity of the actual query (by testing the query to mysql directly)
> > > > > > > > > > > > i realized that the problem can not originate from mysql as such.
> > > > > > > > > > > > A few details:
> > > > > > > > > > > > Model A:
> > > > > > > > > > > > Consists of an (primary key) 'id' of type string, length 16
> > > > > > > > > > > > and a few other fields, most importantly for this example a field
> > > > > > > > > > > > 'code' (string/10)
> > > > > > > > > > > > Model B:
> > > > > > > > > > > > Has a field 'mandantPath' that is related to model A (field id)
> > > > > > > > > > > > through a hasOne() relation.
> > > > > > > > > > > > Now, if i call this the way i do (above), i get the basic results
> > > > > > > > > > > > (fields), but not the joined ones. If i get the SQL query generated by
> > > > > > > > > > > > Doctrine, and use it directly, it works just fine and it returns the
> > > > > > > > > > > > 'code' field as it should.
> > > > > > > > > > > > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > > > > > > > > > > > command, i get the correct results, but of course encapsuled.. so that
> > > > > > > > > > > > i have to loop/parse through the result and set the values according
> > > > > > > > > > > > to my demands.
> > > > > > > > > > > > Pretty frustrating - while i am certain that the problem is very basic
> > > > > > > > > > > > and i just lack the knowledge of a proper solution. Hopefully someone
> > > > > > > > > > > > in here knows what i am dealing with - specifically, what it is that i
> > > > > > > > > > > > am doing wrong.
> > > > > > > > > > > You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> > > > > > > > > > > training, consulting, application development, or business related questions
> > > > > > > > > > > at jonathan.w...@sensio.com
"i actually deal with the option of conflict myself"
well, doctrine does it so that you don't have to do that :P
"When i set my query manually in terminal / mysql client, i get my
result set"
They just present resultset, they don't have to store them in an
array, which can't contain values with the same key. :P
On 10 Lip, 13:21, James Tucker <tenlet...@gmail.com> wrote:
> Interesting point. Makes sense. Regarding my coding situation i find
> it disturbing, because i actually deal with the option of conflict
> myself, thus preventing it. But well, as you say, custom hydrations
> coming up.
> For the sake of completeness:
> When i set my query manually in terminal / mysql client, i get my
> result set,.. it does not struggle with "potential conflicts" and
> other problems alike - i just get my list and the field names are
> perfect. That is why i thought it must be possible to get this from
> doctrine too. Now instead of making a simple doctrine query, i have to
> walk through the results and delevel them each time.
> I yield to thee - in any case, for your patience and your willingness
> to help!
> On 10 Jul., 13:16, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > It is described in docs why they are there.
> > "However, in order to avoid ambiguities between field names all field
> > names in the result set are prefixed with the DQL alias that you
> > specified in the query."
> > They are there to avoid possible conflicts between field names. And
> > SCALAR is that "flat array with the very basic field names". :P There
> > is no other option. Either NONE or SCALAR, you must choose. :P
> > Custom hydrations are introduced in 1.2 branch.
> > On 10 Lip, 13:00, James Tucker <tenlet...@gmail.com> wrote:
> > > That's correct. I have tried it, but discarded it because i can't make
> > > use of the column names with the prefixes. There must be a way to get
> > > just a flat array with the very basic field names from the table /
> > > select plus joins?
> > > On 10 Jul., 12:47, eXtreme <jacek.jedrzejew...@gmail.com> wrote:
> > > > Have you tried HYDRATE_SCALAR? It gives you a flat resultset like you
> > > > want but with column names prefixed with table aliases from query.
> > > > On 10 Lip, 12:44, James Tucker <tenlet...@gmail.com> wrote:
> > > > > Thank you. I do have trouble with this documentation, for i fail to
> > > > > find what i look for. Anyway, your link basically helped me find the
> > > > > correct topic, but the problem persists, for none of the optional
> > > > > hydration modes will give me the results i need.
> > > > > HYDRATION_NONE is the one coming closest, because it returns to me the
> > > > > exact selection from my query in one single array level, but then
> > > > > again it does not include the keys (field names).
> > > > > I have tried all hydration modes, but i just can't find the correct
> > > > > solution.
> > > > > I carefully and kindly ask for help here again, after having gone
> > > > > through the documentational part in detaIl.
> > > > > > On 9 Lip, 14:55, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > Okay, swift me.. it actually works, indeed, but i have another problem
> > > > > > > coming up:
> > > > > > > The result is encapsuled. Which means, i do now get the joined
> > > > > > > results, but i have to parse through them and set them to the main
> > > > > > > array level, in order to be able to return a simple one-levelled
> > > > > > > array / listing. I do not understand this, since i also request p.code
> > > > > > > in my select query, but still i get no field "code" with the desired
> > > > > > > value.
> > > > > > > However, when i set out the SQL query directly, i get returned a
> > > > > > > column code with the appropriate values. Thus, again, this must be
> > > > > > > something i didnt see in Doctrine.
> > > > > > > Does anyone know the solution to this?
> > > > > > > > > > How do you check your result? With toArray() method?
> > > > > > > > > > On 9 Lip, 11:19, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > > > > > Thank you for the hint,
> > > > > > > > > > > i tried it, without select, but the results were exactly the same.
> > > > > > > > > > > Does anyone know what is going wrong here?
> > > > > > > > > > > On 8 Jul., 20:20, Jonathan Wage <jonw...@gmail.com> wrote:
> > > > > > > > > > > > I think it is because you are not selecting enough data from the cc alias.
> > > > > > > > > > > > Try just changing it to a wide open select by removing the select() line.
> > > > > > > > > > > > - Jon
> > > > > > > > > > > > On Wed, Jul 8, 2009 at 1:18 PM, James Tucker <tenlet...@gmail.com> wrote:
> > > > > > > > > > > > > Hello there,
> > > > > > > > > > > > > i encountered a problem, when using a left join command in a query.
> > > > > > > > > > > > > Basically, what happened is that my joined results were not appearing
> > > > > > > > > > > > > in the final results of the query. After carefully testing the
> > > > > > > > > > > > > validity of the actual query (by testing the query to mysql directly)
> > > > > > > > > > > > > i realized that the problem can not originate from mysql as such.
> > > > > > > > > > > > > A few details:
> > > > > > > > > > > > > Model A:
> > > > > > > > > > > > > Consists of an (primary key) 'id' of type string, length 16
> > > > > > > > > > > > > and a few other fields, most importantly for this example a field
> > > > > > > > > > > > > 'code' (string/10)
> > > > > > > > > > > > > Model B:
> > > > > > > > > > > > > Has a field 'mandantPath' that is related to model A (field id)
> > > > > > > > > > > > > through a hasOne() relation.
> > > > > > > > > > > > > Now, if i call this the way i do (above), i get the basic results
> > > > > > > > > > > > > (fields), but not the joined ones. If i get the SQL query generated by
> > > > > > > > > > > > > Doctrine, and use it directly, it works just fine and it returns the
> > > > > > > > > > > > > 'code' field as it should.
> > > > > > > > > > > > > However, when i add type Doctrine::HYDRATE_ARRAY to the execute
> > > > > > > > > > > > > command, i get the correct results, but of course encapsuled.. so that
> > > > > > > > > > > > > i have to loop/parse through the result and set the values according
> > > > > > > > > > > > > to my demands.
> > > > > > > > > > > > > Pretty frustrating - while i am certain that the problem is very basic
> > > > > > > > > > > > > and i just lack the knowledge of a proper solution. Hopefully someone
> > > > > > > > > > > > > in here knows what i am dealing with - specifically, what it is that i
> > > > > > > > > > > > > am doing wrong.