Skip to content

Instantly share code, notes, and snippets.

@shama
Created March 30, 2012 05:02
Show Gist options
  • Save shama/2246649 to your computer and use it in GitHub Desktop.
Save shama/2246649 to your computer and use it in GitHub Desktop.
shama's CakePHP Notes

shama's CakePHP Notes

A collection of notes as I use CakePHP and related projects. Could be items I plan to work on, misunderstandings or curiosities.

CORE

  • basics.php - debug()
    • Output bufferring doesn't work well with debug(), $var = print_r($var, true) can't be used with ob
    • Debug method, mouse over to display file location (it gets in the way)
  • Console
    • Console help should be sorted
  • Controller
    • AuthComponent
      • Make AuthComponent::ALL easier
    • ComponentCollection
      • load() uses Email as example which is deprecated, change to another component
      • Add method to check if component loaded?
    • When extending a controller, this->viewPath / this->name is the extended class and not the child class.
    • L554/L561: May be old code, components, helpers
    • L869/L879: &$this, in 5.4 this may be deprecated pass-by-reference
  • Shell
    • $modelClass not in declaration
    • [OPEN PULL REQUEST] Doesn't load models automatically, must call initialize
    • No tests for Upgrade Shell
    • Calling $this->dispatchShell() it prints the cake header again
  • Error Reporter
  • TestSuite
    • &debug=1 should carry over when clicking to other tests in webrunner
  • TestSuite/CakeHtmlReporter
    • L91 = Checks for .test.php Most of that code looks unneeded
    • Doesn't have test cases
  • AppModel / AppController
    • Ability to set properties of AppModel for all Models from a Controller
  • NumberHelper
    • format() should use defaults like other functions
  • App
    • Test Case for paths, add tests for all keys
    • No test cases for App::core(), App::build()
    • When using reset, doesn't forget all plugins
  • Folder/File Class
    • Test cases for $exceptions
    • copy() should return the copied File
    • search and replace in file
  • Model
    • Lazy load models, doesn't lazy load plugin models when called from a plugin
    • DboSource
      • createSchema: no tests
    • DbAclTest
      • // L351, Typo permissions
      • // L344, NonExistant -> Existent
      • // L478, overall typo
    • models.php
      • // L2427, hierarchal spelled incorrectly
    • ModelIntegration
      • testDeconstructFieldsTime() looks fishy and no real deconstruct() tests
      • no tests for: _createLinks(), _clearCache(), _collectForeignKeys, _deleteDependent(), _deleteLinks(), _filterResults(), _generateAssociation(), getAffectedRows(), only 1 obscure for getLastInsertID(), getNumRows(), hasField(), isForeignKey(), joinModel(), onError(), setInsertID(), _validateWithModels()
  • HtmlHelper
    • nestedList, looks fishy I forget why, look again
    • Look into $theme on Helper.php... not in the docs.
  • FormHelper
    • inputs() should have a before and after option
  • MediaView
    • Test cases for relative to app path?
    • More test cases
  • CakeTestSuite (Dispatcher|Command)
    • l18n, acl fail when tables already exist
    • containable tests fail with prefix
  • View Blocks
    • Form->create() / $this->fetch('inputs') / Form->end()... inputs dont keep model set in create(). You can use Form->setEntity('Model', true) to fix but it would be nice to figure out if can auto work with view blocks.
  • Xml
    • Xml::build() doesn't process natural output of cake Models

DOCS

  • Validation
    • isUnique? Where did it go? It's not in Validation but still exists. Update docs
  • Write example of why fat models are better (code reusability)
  • Finish examples for File/Folder
  • Add more examples to Security
  • Add more how to's for Set
  • Fix the nav, should have at least a 3rd level. It's all mixed up
  • Look into implementing CodeSniffer for examples
  • $this->Helpers->load() doesnt work, update docs
  • Testing
    • Add examples for testAction using GET

DEBUG_KIT

  • ToolbarComponent.php
    • L479 foreach ($query as $key => $value) { what if value is an array? Named params :trollface:

CodeSniffer

  • Add spell check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment