I'm considering creating a plugin for the admin portion of my application and am seeking some guidance on how it should be structured. I will be using CakePHP 2.5.x
.
Part 1:
I will be Auth as well as Acl. Should I be configuring this within /app/Controller/AppController.php
or /app/Plugin/MyPlugin/Controller/MyPluginAppController.php
?
Part 2:
Let's say I want to access the Post Model: /app/Model/AppController.php
from within my plugin. What's the best way to do this within my plugin?
Which one of these files should I create to handle this? Do I even need to create a model within my plugin if I'm just extending the model from the main app?:
//Model
/app/Plugin/MyPlugin/Model/Post.php //Will this conflict with /app/Controller/PostsController.php?
/app/Plugin/MyPlugin/Model/MyPluginPost.php
//Controller
/app/Plugin/MyPlugin/Controller/PostsController.php //Will this conflict with /app/Controller/PostsController.php?
/app/Plugin/MyPlugin/Controller/MyPluginPostsController.php
How should I handle the data within the plugin's Post Controller? Am I on the right track with this?
<?php
// app/Plugin/MyPlugin/Controller/MyPluginAppController.php
App::uses('Posts.Post', 'Controller');
class MyPluginPostsController extends MyPluginAppController {
public function index() {
$this->Post->recursive = 0;
$this->set('posts', $this->Paginator->paginate());
return $this->Crud->execute();
}
}
I realize I've asked a lot of questions, I just want to make sure what I'm doing is feasible/logical.