Hi,
-- I have these two tables:
- Articles
-- id
-- title
-- body
-- type_id (foreign_key)
- Types
-- id
-- title
If i generate che scaffold code for the base application all is perfect, controller, model and view.
bin/cake bake all Types bin/cake bake all Articles
The foreign key is properly insert in the code.
Articles Controller - Index example
...
public function index()
{
$this->paginate = [
'contain' => ['Types']
];
$this->set('articles', $this->paginate($this->Articles));
$this->set('_serialize', ['articles']);
}
...
but if I decide to do the same for a plugin the foreign_key is not recognized,
bin/cake bake all --plugin ExamplePlugin Types bin/cake bake all --plugin ExamplePlugin Articles
PLUGIN - Articles Controller - Index example
...
public function index()
{
$this->set('articles', $this->paginate($this->Articles));
$this->set('_serialize', ['articles']);
}
...
There is no reference to the foreign_key. It would seem only for the controllers.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment