Hi Winzou! Thanks for that!

But, I think that that approach won't do the trick.

e.g :

select a, b objecA A JOIN objectB b where b.is_public_content = true

If that query is an INNER JOIN, then it will return only those objectA that
has at least one related objectB which is_public_content attribute is set to
TRUE.

In other words, objectACollection will be a partial collection.

I need to fetch all objectA and then iterate through its objectBCollection
if any (If it has one) of every objectA.

A LEFT JOIN won't help so much, although it will return all objectA from
database, when I access an objectA's objectBCollection it will
have ALL releted objectB (even those with is_public_content set to FALSE).

If there were no rules I would:

#entity objectA

class objectA {

    public function getPublicObjectBCollection()
    {
       return my_magic_dql_query("Select * From objectB where
is_public_content = true and objectB.objectA_id = ?", $this->id );
    }
}

In fact, this was allowed in S1.4 and Doctrine1. (in the lib/model/doctrine
dir there were ayourTableName.class.php file where you could have done this,
it also had a pair: yourTableName.Table.class.php for other matters).

Thanks again!!!!

2011/6/7 winzou <alexandre.ba...@gmail.com>

> It doesn't change so much the solution.
> Implement a findAllWithPublic() method in the ObjectA repository. This
> method selects objects A, makes the join on objects B with the appropriate
> condition (the is_public_content = true), and returns all that.
> Then you can do your for without any problem.
>
> My point is : you can do almost everything you want with the repository
> concept, use it!
>
> --
> 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

Reply via email to