17488 Posts in 4473 Topics by 1978 members
| Go to End | Next > | |
| Author | Topic: | 3993 Views |
-
onAfterWrite?

9 September 2008 at 5:50am
Is there such a thing? Best I can do is overload the write() function like so..
public function write() {
parent::write();
// do some stuff
}The problem is, the "do some stuff" gets executed 4 times. Any idea why write() gets called so many times? Once for each relation, maybe? And what can I do about this?
-
Re: onAfterWrite?

9 September 2008 at 12:20pm
There should be an onAfterWrite method you can use. Well theres a onAfterWrite() in trunk at least.
-
Re: onAfterWrite?

9 September 2008 at 12:44pm
Cool. Any idea why the write() method runs four times on my updates? Does it run once for every related object?
What I'm trying to do is take data that is saved on the object and duplicate some of the record info into another table when the form is saved. The problem is, when the write() method gets executed 4 times, it makes 4 insertions into that table.
-
Re: onAfterWrite?

9 September 2008 at 12:46pm
Also, while I have you here... I'm wondering, how do you specify the difference between data that was already saved on the record versus info that the user is saving into it through the form?
$this->FieldName
vs.
$this->record['FieldName']doesn't seem to bring different results for me. Should $this->record be populated with the user's form data?
-
Re: onAfterWrite?

9 September 2008 at 1:23pm
Ive just had alook at onBeforeWrite() and it looks like the current value is stored in $this->Field and the new data in $_POST['Field']. Just tried the same with onAfterWrite and it returned exactly the same - $this->Field contained the old values hmm.
-
Re: onAfterWrite?

11 September 2008 at 2:24pm
I'm experiencing similar problems - onBeforeWrite seems to execute multiple times, onAfterWrite does not appear to execute at all.
-
Re: onAfterWrite?

11 September 2008 at 2:25pm
ah, found this on another post:
//WHATCH OUT: The function onAfterWrite() is only useable when you use the Daily builds, it's not included in the Version 2.2.2
function onAfterWrite() -
Re: onAfterWrite?

12 September 2008 at 12:15am
Interesting. Thanks for that. Did we ever figure out why write() and onBeforeWrite() fire so many times?
| 3993 Views | ||
| Go to Top | Next > |


