Re: Issues with edits and afterSave in Cake 2.2

2012-07-10 Thread Ernesto
hi all thx for the response.

@cricket
thanks for the suggestion, i'll try your way

@albert
the data in the DB is ok


Il giorno venerdì 6 luglio 2012 12:06:03 UTC+2, Ernesto ha scritto:
>
> Hi all
>
> i'm having a weird issue with Cake 2.2 model's afterSave()
>
> i need to update some csv files after any order has been saved or updated.
> to achieve this i made a function "processCsv" wich is called by my 
> afterSave().
>
> but my finds() called afterSave() are returning the data without the last 
> updates. why?
>
> here's my code
>
> //in controller
> $this->Order->save($this->data);
>
> //in Order model
> public function afterSave ($created) {
> $this->processCsv($this->data["Order"]["id"]);
> }
>
> public function processCsv ($id) {
> pr($this->findById($id));
> //my code goes here
> }
>

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Issues with edits and afterSave in Cake 2.2

2012-07-07 Thread tigr
Could it be that the data was not COMMITed yet? Check the SQL log?

On Friday, 6 July 2012 12:06:03 UTC+2, Ernesto wrote:
>
> Hi all
>
> i'm having a weird issue with Cake 2.2 model's afterSave()
>
> i need to update some csv files after any order has been saved or updated.
> to achieve this i made a function "processCsv" wich is called by my 
> afterSave().
>
> but my finds() called afterSave() are returning the data without the last 
> updates. why?
>
> here's my code
>
> //in controller
> $this->Order->save($this->data);
>
> //in Order model
> public function afterSave ($created) {
> $this->processCsv($this->data["Order"]["id"]);
> }
>
> public function processCsv ($id) {
> pr($this->findById($id));
> //my code goes here
> }
>

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Issues with edits and afterSave in Cake 2.2

2012-07-06 Thread lowpass
I'm not sure what the problem is but I wonder why you're bothering to
update the CSV file after an edit. I would just create a controller
action through which the CSV is fetched and create it at that time
using the latest data. You can always cache the file if you expect
that it will be fetched often enough. Just be sure to remove the cache
whenever relevant data is added/updated.

On Fri, Jul 6, 2012 at 6:06 AM, Ernesto  wrote:
> Hi all
>
> i'm having a weird issue with Cake 2.2 model's afterSave()
>
> i need to update some csv files after any order has been saved or updated.
> to achieve this i made a function "processCsv" wich is called by my
> afterSave().
>
> but my finds() called afterSave() are returning the data without the last
> updates. why?
>
> here's my code
>
> //in controller
> $this->Order->save($this->data);
>
> //in Order model
> public function afterSave ($created) {
> $this->processCsv($this->data["Order"]["id"]);
> }
>
> public function processCsv ($id) {
> pr($this->findById($id));
> //my code goes here
> }
>
> --
> 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
> cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Issues with edits and afterSave in Cake 2.2

2012-07-06 Thread Ernesto
Hi all

i'm having a weird issue with Cake 2.2 model's afterSave()

i need to update some csv files after any order has been saved or updated.
to achieve this i made a function "processCsv" wich is called by my 
afterSave().

but my finds() called afterSave() are returning the data without the last 
updates. why?

here's my code

//in controller
$this->Order->save($this->data);

//in Order model
public function afterSave ($created) {
$this->processCsv($this->data["Order"]["id"]);
}

public function processCsv ($id) {
pr($this->findById($id));
//my code goes here
}

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php