When executing $model->unsetAttributes()
I get an error
Fatal error: Call to undefined method MyModule :: unsetAttributes ()
Tell me how to fix it?
This error indicates that your variable is not a model, but an instance of the class MyModule
that does not have an unsetAttributes()
method.
First, you need to fix the creation of the model, and secondly, you need to add a check, so as not to frighten ordinary users:
if(method_exists($model, 'unsetAttributes')){ // action }
The answer is from the question itself.
Most likely, the model with the same name is already somewhere initialized. Because most often initialize models and components like this:
$this->setImport(array( 'mymodules.models.*', ));
it is possible where the machine hooked.
Source: https://ru.stackoverflow.com/questions/450061/
All Articles
MyModule
class it isMyModule
say anything concrete. - Dmitriy Simushev