cakephp find('all') statement returns double entry -
i working site using cakephp 1.3. last month have changed hosting service of site. after having issue.
ie. have bookings table in db. when using find() statement, bookings table returns double entry. not find why happening.
for example, got vehicle data of particular place returns below,
when use 'recursive'=>2 in find('all') statement ,i got following
**
parking location : chennai citi centre 2w booking date : 02/04/2013 booking id transaction type vehicle no check in date check out date 187994 normal 7099 02/04/2013 18:31 02/04/2013 22:03 187994 normal 7099 02/04/2013 18:31 02/04/2013 22:03
**
but when use 'recursive'=>-1 in find('all') statement,i got following
** parking location : booking date : 02/04/2013 booking id transaction type vehicle no check in date check out date 187994 normal 7099 02/04/2013 18:31 02/04/2013 22:03
**
here parking location not coming. in providers table.
please me fix this
normally wouldn't recommend using other recursive=>-1
, , use containable behavior when appropriate. can't tell why first approach returns double entries without knowing models associations, or having exact find query you're using (are doing find() bookings or parking or else :s ?), try , use containable , see if works.
something like... (i'm going assume how models called , how you're using find())
$this->booking->find('all', array('conditions'=> array() ,//some conditions here 'recursive' => -1, 'contain' => array('parking'));
after that, dump of returned array see if output fits needs. more of containable behavior check here.
Comments
Post a Comment