When i set the paginate var in the function it only selects the
category data, not the article table :(
Function:
public function category($category_name)
{
// Pagination settings
$this->paginate = array('limit' => 15,
'page' => 1,
'order'=>array('id' => 'desc'),
'fields' => array('id', 'name'));
$this->set('articles', $this->paginate('Category',
array('name' =>
$category_name)));
}
Category model:
public $name = 'Category';
// Table name
public $useTable = 'categories';
public $hasAndBelongsToMany = array(
'Article' =>
array('className' => 'Article',
'joinTable' => 'articles_categories',
'foreignKey' => 'article_id',
'associationForeignKey'=> 'category_id',
'conditions' => '',
'order' => '',
'limit' => '',
'unique' => true,
'finderQuery' => '',
'deleteQuery' => '',
)
);
Result:
Array
(
[0] => Array
(
[Category] => Array
(
[id] => 3
[name] => PHP
)
[Article] => Array
(
)
)
)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---