Cakephp: Why is Model not being loaded correctly?

Asked

Viewed 79 times

1

Model: CategoriaBanner
Controller: CategoriasBannersController

One thing’s keeping me up at night: When trying to use create(); it gives object error when trying to use what would be the corresponding Model:

$this->CategoriaBanner->create();

Error: Call to a Member Function create() on a non-object File: /my/path/to/project/app/Controller/Categoriasbannerscontroller.php Line: 8

I’ve tried to add public $uses = 'CategoriaBanner'; but I didn’t succeed. What could it be? Note: I am using the Cakeptbr to solve the inflections, and I don’t intend to settle with loadModel, because I want to use for the convention.

  • 1

    It would be interesting to see your controller code.

  • Your $uses statement is wrong.

1 answer

1


Apparently, your solution to inflections is not working, but the $uses nor would it be necessary. Your attempt with $uses was incorrect, because the value of this property needs to be an array. Try this way:

public $uses = array('CategoriaBanner');

Browser other questions tagged

You are not signed in. Login or sign up in order to post.