No on knows how to solve this issue? I have a few very complicated work arounds, but every time I end up implementing such work arounds, it always comes back to the fact that I was doing it wrong originally.
~Michael On Fri, Jul 6, 2012 at 12:09 AM, Michael Gaiser <[email protected]> wrote: > So I am having some issues getting Paginate to recognize its associated > models when handling its conditions. Some events have a location_id, but > others (like the feeding event) have their location id specified in > the associated model. From the Events Index page I want to do a search for > all events that have the location_id = 87. Heres my setup. > > Event hasMany Feeding (EventsFeeding table) > > $conditions['OR'] = array( > 'Event.location_id'=>87, > 'Feeding.location_id'=>87, > ); > > > $this->paginate = array( > 'limit'=>$count, > 'contain' =>array( > 'Feeding'=>array('id', 'event_id', 'location_id'), > ), > 'fields'=>array('id', 'event_type_id', 'location_id', 'start_date', > 'end_date', 'created', 'modified'), > 'order'=>array('Event.start_date ASC') > ); > > $events = $this->paginate($conditions); > > > This is the error I get: > *Error: *SQLSTATE[42S22]: Column not found: 1054 Unknown column > 'Feeding.event_id' in 'field list' > > > I have looked around, some solutions I have found try to make use of a > fake hasOne bind, others try to setup a virtual field others play around > with the 'joins' array. I have tried all of these but cannot seem to get > them to work. Any help would be greatly appreciated. > > ~Michael > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
