Hello All,
I get this error message "Column 'author' doesn't belong to any of the selected models (2)" when select data from database using querybuilder as follow
$builder = $this->modelsManager->createBuilder()
->from('Webapp\Frontend\Models\Blog')
->where('author = :author:',array("author" => $auth[id]))
->orderBy('Webapp\Frontend\Models\Blog.id');
// Create a Model paginator, show 10 rows by page starting from $currentPage
$paginator = new \Phalcon\Paginator\Adapter\QueryBuilder(
array(
"builder" => $builder,
"limit"=> 10,
"page" => $currentPage
)
);
$page = $paginator->getPaginate();
$this->view->setVar("page", $page);
I use the same method when select data from other table and they working fine but not work with my last create table.
class Blog extends \Phalcon\Mvc\Model
{
/**
*
* @var integer
*/
public $id;
/**
*
* @var integer
*/
public $author;
/**
*
* @var integer
*/
public $category;
/**
*
* @var string
*/
public $title;
/**
*
* @var string
*/
public $slug;
/**
*
* @var string
*/
public $intro;
/**
*
* @var string
*/
public $content;
public function initialize()
{
}
}
MySQL Column
- id int(11)
- author int(11)
- category int(11)
- title varchar(255)
- slug varchar(255)
- intro varchar(255)
- content longtext
What I do wrong on this query builder?
another question - what is meaning of (2) in "Column 'author' doesn't belong to any of the selected models (2)"?
Thank you for any help.