How many ways can you generate a CakePHP Admin interface? A summary of the available methods, as well as an intro to CakeAdmin, a class-based admin generation tool.
@access public */ public function index() { // Only do this work if our concrete controller has not. if (!isset($this-‐>viewVars[Inflector::pluralize($this-‐>modelClass)])) { $this-‐>set(array( Inflector::pluralize($this-‐>modelClass) => $this-‐>paginate( $this-‐>modelClass, /** * Here we toss in any conditions that were found as named * parameters and which match up to a column in the model * schema. */ array_intersect_key( $this-‐>params['named'], $this-‐>{$this-‐>modelClass}-‐>schema() ) ) )); } } From https://github.com/joebeeson/crumbs/blob/develop/app_controller.php
• Generated view() can result in an empty page • Generated delete() lets crawlers potentially auto-delete site • Model::read() usage is evil • Asks too many questions; Can’t I just answer once and rebake?
• Can’t use Croogo/Infinitas/etc. • Need to replicate similar admin interfaces across projects • Let less technical developers create their own interfaces
// Guess var $defaults = array( /* some options */); // Should we enable this by default var $enabled = true; // Plugin where the templates for this action are located var $plugin = 'cake_admin'; // Action type var $type = 'index'; // How do we "link" to this method var $linkable = 'List {{modelname}}'; // Custom model methods (find, related) var $methods = array('find'); // How do we merge our defaults and configuration? function mergeVars($admin, $configuration = array()) { } }