Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion ManytoMany Join with foreign table and Association Filtering Criteria
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:
Followup To:
Add Cc | Add Followup-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 you hear
 
Vincent Wasteels  
View profile  
 More options Nov 9 2012, 9:41 am
From: Vincent Wasteels <vincent.waste...@gmail.com>
Date: Fri, 9 Nov 2012 09:40:49 -0500
Local: Fri, Nov 9 2012 9:40 am
Subject: Re: [doctrine-user] Re: ManytoMany Join with foreign table and Association Filtering Criteria

Hello !

it gives me the join table , that's my problem ...

2012/11/8 Gregory McLean <cent...@gmail.com>

> On 11/08/2012 05:28 PM, Vincent Wasteels wrote:
> > Hello, thx for ur answer !!

> > I'm using a third table for the relation and some extra fields , so I
> can't
> > just do $this->article

> > I can access : $this->categoryArticle , but the attribute I have to
> filter
> > is in Article itself ...

> So $this->categoryArticle() gives you your article entity or the
> join_table entity?

> > I'm stuck on this ... !

> > thanks for ur help !! much appreciated !

> > Le jeudi 8 novembre 2012 16:33:40 UTC-5, Gregory McLean a écrit :

> >> In your category entity use the collection criteria, and something like
> >> (I'm paging the results)

> >> public function getRelatedArticles($start = 0, $limit = 10)
> >> {
> >> $criteria = Criteria::create()
> >>             ->where('ispublished = true');

> >> return $this->articles->matching($criteria);
> >> }

> >> Then in the article entity add the @OrderBy annotation on the manytomany
> >> bit

> >> @ManyToMany(<blah blah blah>)
> >> @OrderBy("created" = "ASC|DESC")

> >> Then it _should_ do what you want when in the template you do

> >> {% for related in article.category.relatedarticles %}
> >>     {{ related.name }}
> >> {% endfor %}

> >> This of course is if I'm understanding how you have all the entities
> >> mapped.

> >> On Thursday, November 8, 2012 11:52:41 AM UTC-5, Vincent Wasteels wrote:

> >>> Hello doctrine !!

> >>> I have a model like this :

> >>> Article 1.* ArticleCategory *.1 Category

> >>> In my Category Entity, I want to get all article related to $this ,
> >>> orderBy article.created and where article.published is true ,

> >>> I could do :

> >>> $articles = array();
> >>> foreach($this->getArticleCategory() as $art_cat){
> >>>     $article = $art_cat->getArticle();
> >>>     if($article->isPublished()) $articles[] = $article;
> >>> }

> >>> But It won't deal the orderBy, and it seems too heavy anyway...

> >>> The Criteria from Doctrine Collection is more appropriated but I don't
> >>> see how to handle the relation table,

> >>> and I don't want to do this in a repository since it concerns a
> specific
> >>> Category,

> >>> Any hints for me ?

> >>> thanks !!

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


 
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.