Type: die(debug($variable));
...in your model, and it will stop processing and print $variable to screen. Jeremy Burns Class Outfit [email protected] http://www.classoutfit.com On 3 Feb 2011, at 08:35, Axel wrote: > Hello! > > Following a previous comment (http://groups.google.com/group/cake-php/ > browse_thread/thread/f8a2060c617c8fb6/5f50c5ee5ebed975? > hl=en#5f50c5ee5ebed975), I was starting to put the work on my data in > the models instead of the controllers. Unfortunately, I have no idea > how to debug what is inside of my model? How is it possible to know > if it is correct? (cake 1.3) > > My case is : > I'm building a racing game > > I have CHAMPs (championship) hasMany TEAMs hasMany DRIVER > I have also CHAMP hasMany RACE hasMany ORDER (race orders). > I've also TRACK HasMany RACE > I've also TEAM HasMany ORDER > > So I have a function CalcPackage which determines the package (which > is the value of the car of my team on a race). To calculate the > package I need the values of the car (TEAM) and the values of the > TRACK (in function of the track the car is better or not). The global > package is a weighted sum of the separate package of 5 elements. This > function is a function of TEAM model. > > When I create a new RACE, I want my program to calcPackage of > everyteam. > > So : > > Races_controller.php: > function add() { > (...) > > $race=$this->data; > > //Recovery of the list of the team that are part of the race > $this->loadModel('Team'); > $team_list=$this->Team->find('all', array('fields' => > array('id'), 'conditions' => array('champ_id' => $race['Race'] > ['champ_id']), 'recursive' => 0)); > > //Package calculkation for that race > $team_nb=count($team_list); > > for($i = 1; $i <= 5; $i++) > { > $c_car='c_car'.$i; > $track_coeff[]=$race['Track'][$c_car]; > } > > for ($i=0;$i<$team_nb;$i++) > { > $this->Team->calcPackage($track_coeff,$team_list[$i]['Team'] > ['id']); > } > (...) > } > > TEAM model : > > function calcPackage($track_coeff,$teamID) > { > > $team=$this->findById($teamID); > $pack=0; > for($i = 1; $i <= 5; $i++) > { > $p_car='p_car'.$i; > $pack+=$track_coeff[$i-1]*$team['Team'][$p_car]; > } > > $team['Team']['p_current']=$pack; > $this->save($team); > return $pack; > } > > > > ------------ > > The problem is that I don't know if this set up is ok, and I have a > bug in my model but I'm not able to see which one. What are the > debugging possibilities? > > Thank you a lot for your answers! > > -- > 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 -- 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
