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.

You’re the MAN!!!
Thanks so much for taking the time collecting and posting this. It goes a long way in helping us mere mortals :)
Found this Deprecated List from API http://api.cakephp.org/1.2/deprecated.html
@Beth, phpsc: Thanks for your comments!
@phpsc: Thanks for the link, I wasn’t aware there exists such a page in the API.
Model::generateList() deprecated, use Model::find(‘list’)
r6360 commit introduced a way to do custom fields
Model::find(‘list’, array(‘fields’ => array(‘Model.id’, ‘Model.custom_name’))
Now that is beautiful API
@speedmax: Yes, it is nice, even though it is probably more difficult to use it (without documentation).
[...] lainnya, setelah browsing sana-sini akhirnya ketemu juga dengan daftar deprecated stuff di blognya CakeBaker, jika anda sedang belajar CakePHP 1.2 mungkin daftar ini bisa jadi pertimbangan, soalnya beberapa [...]
[...] with the new functionalities are the deprecated ones. Check out the Deprecated Stuff in CakePHP 1.2 for a list of the deprecated items. Although these stuffs still work, they are not recommended for [...]
I might be missing something, but the new method for generating lists is not as good. My issue is that, previously with generateList, both the ID and display name could be specified. Now in 1.2, only the display name can be specified, and the primary key is assumed as the ID. I looked through the model.php code as well, and it looks like there’s no value that can be passed in to overwrite this.
If anyone sees a solution for this, I would be very grateful for your help!
Oops, I missed speedmax’s response. That should solve my problems, I’ll check it out!
Thank you. Your blog kicks ass.
[...] cakebaker.42dh.com – Deprecated stuff in CakePHP 1.2 [...]
@JDS: Thanks!
i’ve try
Model::find(’list’, array(’fields’ => array(’Model.id’, ‘Model.custom_name’))
but it returned array (‘id’='id’) instead (‘id’=>’custom_name’)
:(
@marcin: Hm, which CakePHP version do you use?
i should convert $this->Company->generateList() to $this->Company->find(‘list’); for 1.2 as generateList is depricated. But how can i convert $this->Company->generateList(null,null,null,null,’{n}.Company.company_name’); ?
@KireZ: Something like
$this->Company->find('list', array('fields' => array('Company.company_name')));should do the trick.
Hope that helps!
how can i convert this:
$this->set(‘Cat_List’,$this->Ad->Cat->generateList(null, ‘name_de ASC’, null, ‘{n}.Cat.id’, ‘{n}.Cat.name_de’));
if i convert it as below:
$this->set(‘Cat_List’,$this->Ad->Cat->find(‘list’,array(‘order’=>’name_de ASC’,'fields’=>array(‘{n}.Cat.id’,'{n}.Cat.name_de’)))));
it only returned me:
array (’id’=’id’) instead (’id’=>’name_de’)
@yunhaihuang: Hm, your example with find causes an error here (I’m using the latest version from the repository). If I remove the “{n}” from the fields array, then I get id/name_de pairs as result.
Hope that helps!
Thanks a lot for the information, I have to migrate from 1.1 to 1.2, and this information will be VERY usefull. Thx!!!!!
@Pablo: Good luck with your migration!
Thanks for your help! But it’s work as i expect, althought i remove the ‘{n}’(i’m using cakephp beta). with best wishes!
i’m sorry about my mistake.
it doesn’t work as i expect, althought i removed the ‘{n}’.
please help me overcome this error.
i’m sorry about my mistake.
it doesn’t work as i expect, althought i removed the ‘{n}’.
please help me overcome this situation.
@yunhaihuang: What doesn’t work? Can you give an example of what you try and what you expect?
i want it return a list (cat.id/cat.name_de), but it only return me a list with cat.id
@yunhaihuang: Set debug to 2 (in app/config/core.php) and look what SQL code cake generates. Maybe you can then figure out what’s going wrong…
If not, which cake version do you use?
Hi Everyone,
You can do like this
$this->Ad->Cat->displayField = ‘name_de’;
$this->set(’Cat_List’,$this->Ad->Cat->find(’list’));
@Pravin: Thanks for your hint!
@Pravin: Thankz for nice info!
@Pravin: Thanks for very much!
I read alot about setting the displayName but nothing about being able
to set it “on the fly” in the controller. That little bit of info was sooooo missing for me. :-)
I have the same problem, i solved with:
$this->Cat->displayField = ‘name_de’;
It can be used too in model cat.php:
var $displayField = ‘name_de’;
Uf… before, we make “generaleList” and go! now is more work :P
If we use in the BD definition ‘title’ or ‘name’, then it work ok.
@josepzin: Thanks for your explanations!
Hi!
Trying to use the Ckae 1.2′s “find” functions, and having an hard time! My problem is the following:
i’d like to fetch data from a table. What idon’t know is the form of data “find” returns.
A sample of my code :
$entry = $this->SearchWord->find(‘list’, array(‘conditions’ => array(‘SearchWord.word_text’ => $tempWord) , ‘fields’ => array(‘SearchWord.id’, ‘SearchWord.word_text’)));
$matchToSave['search_word_id'] = $entry['id'];
at execution time, i have the following error :
Notice (8): Undefined index: id [APP\controllers\users_controller.php, line 753]
Any idea?
Thanks a lot!
@olivier: Add a debug($entry); statement and you will see why you get that error ;-)
Will try it out tonite. Thanks !!
Thank you for the tip cakebaker. the $debug output helped me use the find() return efficiently
A question on the form helpers in Cake1.2:
it seems that specifying a size for a text area (or any other form element) has absolutely no effect on the look of the element. The size cannot be changed and the default size is just inappropriate (too large).
How can one set the form elements’ size and expect a result with Cake1.2?
@olivier: Cool to hear it was helpful for you :)
And regarding your question, you can set all HTML attributes by using the $options parameter of the respective method. For example:
$form->input('Model.field', array('size' => 100));Hope that helps!
I think i’ve tried that already. Will try again tonite and tell you the result. Thank you
Hello, I tried (again) to specify the length of the form field. And it doesn’t seem to change. Even if I go from 5 to 100. The field lenght remains unchanged. Have you successfully tried to set a form’s size with Cake 1.2?
@olivier: Yes, it works fine here (with the latest version of cake 1.2 from the repository). Maybe you have defined a size for “input” in your CSS file? Then the size attribute of the input tag is ignored. Also have a look at the generated HTML code, is it correct?
Hope that helps!
[...] next useful place I would point you is to this information on deprecated stuff. There is a lot of stuff that’s been removed or replaced in 1.2, so if you are using any of [...]
Hello!
i finally got an answer to my question: the field i wanted to change the size was mapped to a VARCHAR field type in my db. Cake took the length of the VARCHAR as the default length of the field (or “maxlength”, should I say).
Thank you very much for your help.
Olivier
@Olivier: Cool to hear you found an answer! Bake on :)
Eg.
$recursive = -1;
$conditions = array(‘Product.active’ => ’1′);
$fields = array(‘Product.name’);
$arr_products = $this->Product->find( ‘list’, array( ‘conditions’ => $conditions, ‘fields’ => $fields, ‘recursive’ => $recursive) );
$arr_products = $this->Product->find( ‘list’, array( ‘conditions’ => $conditions, ‘fields’ => $fields, ‘recursive’ => $recursive, ‘order’ => ‘Product.name ASC’ ) );
@Waruna: Hm, what do you want to say with your comments?
The new 1.2.1.8004 CSS sets the input & text field size to 100% in the css. You need to go in and remove that from the css and the size options parameter for your fields will work fine.
@Keith: Thanks for this hint, I wasn’t aware of it (I usually don’t use the CSS that comes with CakePHP).
findBySql() has also been deprecated. Use query().
@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.
hi,
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.
@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!