Closed huuphuc2401 closed 7 years ago
The query is executed when you say it has to be executed, so when you call save() on the object.
You'll have to debug further, perhaps observers on related models that interfere? You can use Debug::backtrace()
to output the call path if you want to see how you got to a certain place in the code.
@WanWizard I used Debug::backtrace()
and found problem (observers on related models as you said). Thank you so much.
You're welcome.
I have an Model_M with 2 observers:
A
use Model_Log to write logs when Model_M changed ()B
calculate something base on logsI add Observer
A
andB
to Model_M with order:A
first andB
later.I debug in php and see that the process
write log
is run first andcalculating
is run laterExpected result
calculating
process can find the logResult
calculate
process can not find the log (I checked in Profiling, the sql query ofcalculating
is executed before the sql query ofwrite log
)