Re: [symfony-users] "sfGuardUser" with an alias of "s" in your query does not reference the parent component it is related to.

2010-08-30 Thread Sebastien Armand [Pink]
The left join with Doctrine works on the Relation defined in the schema.yml
(or not, depending if you're using this way to define your model). In a
doctrine query like this, you need to use that relation name and use the
prefix of the class you're already querying to it. So for example:

model =

company:
  columns:
name:
logo:
etc...
  relations:
Users:
   class:  sfGuardUser

then to query a company and the attached user you would need to do:

$q = new Doctrine_Query();
$q->from('Company c')->leftJoin('c.Users')

So you need the prefix 'c.' in order to say that you join the users related
to this company. And the name used should not necessarily be the name of the
model, but the name of the relation.

In your case since you add this to a possibly already existing query, you
will not necessarily know if the root alias is 'c' or 'comp' or whatever.
But I think you can access it through $q->getRootAlias().


2010/8/29 Inform4tic4mente 

> I got the error reported in subject when tryng to do something like
> this:
>
> public function addWithUserQuery (DoctrineQuery $q = null)
>{
>if (is_null($q))
>{
>$q = $this->createQuery();
>}
>$q->leftJoin('sfGuardUser s');
>
>return $q;
>}
>
> in a table class. I'm pretty new to symfony, and I have no clue on what
> this error means. I'm using the the latest svn revision in 1.4 branch.
> Anyone can help, please? :)
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> 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
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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


[symfony-users] "sfGuardUser" with an alias of "s" in your query does not reference the parent component it is related to.

2010-08-30 Thread Inform4tic4mente
I got the error reported in subject when tryng to do something like
this:

public function addWithUserQuery (DoctrineQuery $q = null)
{
if (is_null($q))
{
$q = $this->createQuery();
}
$q->leftJoin('sfGuardUser s');

return $q;
}

in a table class. I'm pretty new to symfony, and I have no clue on what
this error means. I'm using the the latest svn revision in 1.4 branch.
Anyone can help, please? :)

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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