Wednesday, December 19, 2012

Apply condition on assocaition

i have three tables

1. Rates: [id, Price, CourseID, others...]
2. Course: [id, noofpoints, GCources_id, others....]
3. GCourcess: [id, WeekIncFriday, Type, others........]

i mapped relationship between them [Rates -> Cources -> Gcources] , now i want to get data from Rates and apply condition on GCources

My Query is

    $this->Rate->Behaviors->attach('Containable');
            $Rate = $this->Rate->find(
                    'first', array(
                'conditions' => array(
                    'Rate.CourseID' => $courses_array
                ),
                'contain' => array(
                    'Course' => array(
                        'GCourcess' => array(
                            'conditions' => array(
                                'GCourcess.WeekIncFriday' => 1
                            )
                        )
                    )
                )
                    )
            );



This generate error "Column not found: 1054 Unknown column 'GCourcess.WeekIncFriday' in 'where clause'"

**My quastion how can i apply this condition GCourcess.WeekIncFriday = 1 from Rates table?**


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: