Deprecated stuff in CakePHP 1.2

Published on and tagged with cakephp  deprecated

Yesterday I got asked by Beth in a comment whether there is a list of deprecated stuff. As I am not aware of such a list I compiled one by searching for the term “deprecated” in the cake folder of CakePHP 1.2beta. You find the results below. Most of the deprecated stuff still works, but some of it will show you a notice when used during development (when debug > 0). It is recommended to no longer use the deprecated stuff, as it is possible it will be removed in future releases. Ok, here we go:

On the console the command

cake acl initdb

has been replaced by

cake schema run create DbAcl

In basics.php all load functions have been replaced by App::import(): loadView(), loadModel(), loadController(), loadHelper(), loadPluginHelper(), loadComponent(), loadPluginComponent(), loadBehavior(), loadModels(), loadPluginModels(), and loadControllers().

The function listClasses() has been replaced by Configure::listObjects(), and the implementations of setUri() and setUrl() have been moved to the dispacher and are now called uri() resp. getUrl().

The initialization of the cookie component has changed, it should be configured in the beforeFilter of the controller and therefore the initialize() method should no longer be used.

The implementation of cleanUpFields() has been moved from the controller to Model::deconstruct().

In the model two methods are deprecated: loadInfo() has been replaced by Model::schema() and generateList() by Model::find(‘list’). Also the parameter usage of validates() and invalidFields() has been deprecated, you have to set the $data property instead.

In the form helper the method submitImage() should no longer be used, instead the submit() method can be used.

As there is the form helper for creating form elements, all form-related methods in the HTML helper are deprecated: radio(), password(), textarea(), checkbox(), hidden(), input(), tagValue(), validate(), validateErrors(), and tagErrorMsg().

In the Javascript helper the $safe parameter for the codeBlock() method, plus the parameters $prefix, $postfix, $stringKeys, $quoteKeys, and $q for object() are deprecated.

In the helper class the method setFormTag() has been replaced by setEntity().

The properties $themeElement, $themeLayout, and $themePath are no longer needed in the theme class.

In the file class many methods have been renamed, and therefore the old names are deprecated: getFullPath(), getName(), fileName(), getExt(), getMd5(), getSize(), getOwner(), getGroup(), getChmod(), and getFolder().

The functionality of chmodr() and mkdirr() from the folder class is now handled by chmod() resp. mkdir().

In the router the routes for web services are deprecated: “/rest/”, “/rss/”, “/soap/”, “/xml/”, and “/xmlrpc/”. The same is true for the routes “/bare/” and “/ajax/”.

Last, but not least, the validation constants VALID_NOT_EMPTY, VALID_NUMBER, VALID_EMAIL, and VALID_YEAR are deprecated.

56 comments baked

  • cakebaker

    @Keith: Thanks for this hint, I wasn’t aware of it (I usually don’t use the CSS that comes with CakePHP).

  • Neil

    findBySql() has also been deprecated. Use query().

  • cakebaker

    @Neil: Yes, you are right, findBySql() is deprecated resp. no longer exists in the current versions (1.2.5 and 1.3alpha). Thanks for mentioning it.

  • Naveen

    am getting the following error.
    Undefined index: MailTrigger [APP\views\mails_triggers\index.ctp, line 131].

    MailTrigger is the name of my Model.

    in index.ctp

    I have done this before but, y do i keep getting the error with respect to the Model.

    My Model.

    Could you please provide me with some information on this.

  • cakebaker

    @Naveen: Well, some parts of your comment got eaten by WordPress… So the only advice I can give you is to use the debug() function to see the structure of the data passed from the controller to your view.

    Hope this helps a bit!

  • CakePHP Developer Links - PRONIQUE Software

    […] your code with foldersHow Easy Are Web Services in CakePHP 1.2? Really Easy! — @TheKeyboardDeprecated stuff in CakePHP 1.2 – cakebakerFat models and how they change how you use the Model class – cakebakerCake PHP useful tips: 21 […]

© daniel hofstetter. Licensed under a Creative Commons License