Re: save() omitted

2010-07-17 Thread Marcelo F Andrade
On Thu, Jul 1, 2010 at 1:57 PM, Andrei Mita andrei.m...@gmail.com wrote: I am unbelievably stupid some times. I have lost two days trying to figure this one out and it never crossed my mind to check the validation rules in the model. And everything was right there in the manual: If for some

save() omitted

2010-07-01 Thread Andrei Mita
Hello, I have tried many different ways to update a record in one table with no luck. In one simple function I have 2 save(update) queries. The first one is always skipped. This is the one: $game_final = array( 'id' = $this-Session-read('Game.game_id'), 'scored' = $scored, 'conceded' =

Re: save() omitted

2010-07-01 Thread Edinei L. Cipriani
If you have id, you do not need to use create () 2010/7/1 Andrei Mita andrei.m...@gmail.com Hello, I have tried many different ways to update a record in one table with no luck. In one simple function I have 2 save(update) queries. The first one is always skipped. This is the one:

Re: save() omitted

2010-07-01 Thread Andrei Mita
I've tried without create, no result. On Thu, Jul 1, 2010 at 6:40 PM, Edinei L. Cipriani phpedi...@gmail.comwrote: If you have id, you do not need to use create () 2010/7/1 Andrei Mita andrei.m...@gmail.com Hello, I have tried many different ways to update a record in one table with no

Re: save() omitted

2010-07-01 Thread Edinei L. Cipriani
Try: $game_final['Game'] = array( 'id' = $this-Session-read('Game.game_id'), 'scored' = $scored, 'conceded' = $conceded, 'correct_answers' = $correct_answers, 'wrong_answers' = $wrong_answers, 'time_end' = date('Y-m-d H:i:s'), 'outcome' = $game_outcome); $this-Game-save($game_final); Em 01/07/10

Re: save() omitted

2010-07-01 Thread Andrei Mita
No luck. I don't get it. No errors, nothing. It's as if the query isn't there. The only thing I get from sql dump is: SELECT COUNT(*) AS `count` FROM `games` AS `Game` WHERE `Game`.`id` = 1 SELECT COUNT(*) AS `count` FROM `games` AS `Game` WHERE `Game`.`id` = 1 On Thu, Jul 1, 2010 at 7:12 PM,

Re: save() omitted

2010-07-01 Thread Edinei L. Cipriani
Em 01/07/10 13:24, Andrei Mita escreveu: No luck. I don't get it. No errors, nothing. It's as if the query isn't there. The only thing I get from sql dump is: Try: pr($game_final); die(); It seems to me that they are accessing the correct action Check out the new CakePHP Questions site

Re: save() omitted

2010-07-01 Thread Andrei Mita
Where should I try that? View, controller? On Thu, Jul 1, 2010 at 7:33 PM, Edinei L. Cipriani phpedi...@gmail.comwrote: Em 01/07/10 13:24, Andrei Mita escreveu: No luck. I don't get it. No errors, nothing. It's as if the query isn't there. The only thing I get from sql dump is: Try:

Re: save() omitted

2010-07-01 Thread Edinei L. Cipriani
Em 01/07/10 13:39, Andrei Mita escreveu: Where should I try that? View, controller? Controller. On Thu, Jul 1, 2010 at 7:33 PM, Edinei L. Cipriani phpedi...@gmail.com mailto:phpedi...@gmail.com wrote: Em 01/07/10 13:24, Andrei Mita escreveu: No luck. I don't get it. No errors,

Re: save() omitted

2010-07-01 Thread Andrei Mita
I believe it's OK Array ( [Game] = Array ( [id] = 2 [scored] = 0 [conceded] = 6 [correct_answers] = 0 [wrong_answers] = 30 [time_end] = 2010-07-01 19:47:49 [outcome] = -1 ) ) On Thu, Jul 1,

Re: save() omitted

2010-07-01 Thread Andrei Mita
I am unbelievably stupid some times. I have lost two days trying to figure this one out and it never crossed my mind to check the validation rules in the model. And everything was right there in the manual: If for some reason your data isn't saving, be sure to check to see if some validation rules

Re: save() omitted

2010-07-01 Thread Edinei L. Cipriani
Em 01/07/10 13:57, Andrei Mita escreveu: I am unbelievably stupid some times. I have lost two days trying to figure this one out and it never crossed my mind to check the validation rules in the model. And everything was right there in the manual: If for some reason your data isn't saving, be

Re: save() omitted

2010-07-01 Thread Andrei Mita
The action is the above one and the model(with validation rules deleted): ?php class Game extends AppModel { var $name = 'Game'; var $belongsTo = array( 'Stage' = array( 'className' = 'Stage', 'foreignKey' = 'stage_id', ), 'User' = array(

Re: save() omitted

2010-07-01 Thread Edinei L. Cipriani
try to do an insert with the data you are testing directly into your database, so I noticed you need the user_id and stage_id 2010/7/1 Andrei Mita andrei.m...@gmail.com The action is the above one and the model(with validation rules deleted): ?php class Game extends AppModel { var

Re: save() omitted

2010-07-01 Thread Andrei Mita
It is solved. When I created my table I defined outcome as tinyint and when baked, cake made a validation rule to be boolean. I then realized I need at least 3 values for that field and changed it to float. When trying to update the record with -1 the validation rule was broken and no update was