posted 09/7/2008 by Chris

After waiting longer than I should have, I decided to spend the day upgrading a few cakephp 1.1 projects to use the new 1.2 core. One word I hate to cross while upgrading an api is deprecated, and unfortunately I crossed it a few times during my upgrade...

 

 

UPDATE #1 = You can no longer use the vendor() function in controllers

 

Using the 1.1 core, I would include a vendors like this :

vendor('fckeditor');

 

Using the 1.2 core, I needed to include a vendor like this :

App::import('Vendor','fckeditor');

 

 

UPDATE #2 = You have to use a new syntax in the file /app/config/core.php

 

Using the 1.1 core, I would change the debug mode like this :

define('DEBUG', 1);

 

Using the 1.2 core, I needed to change the debug mode like this :

Configure::write('debug', 1);

 

 

UPDATE #3 = You have to use a new syntax in the file /app/config/routes.php

 

Using the 1.1 core, I would add a route like this :

$Route->connect('/resources/affiliates', array('controller' => 'resources', 'action' => 'affiliates'));

 

Using the 1.2 core, I needed to add a route like this :

Router::connect('/resources/affiliates', array('controller' => 'resources', 'action' => 'affiliates'));

 

 

UPDATE #4 = You must start urls for the redirect() function with a forward-slash

 

Using the 1.1 core, I would redirect to the debuggeddesigns.com/services page like this :

$this->redirect('services');

 

Using the 1.2 core, I needed to add a forward-slash before the url :

$this->redirect('/services');

Aside: using cake's webroot variable is how I actually fixed the problem : 

$this->redirect($this->webroot.'services');

 

 

UPDATE #5 = You have to create text input boxes with the FormHelper class now

 

Using the 1.1 core, I would add a text input box using the HtmlHelper class like this :

$html->input('Blog/title', array('value'=>'', 'style'=>'width:200px;'));

//outputs: <input type="text" name="data[Blog][title]" id="BlogTitle" value="" style="width:200px;" />

 

Using the 1.2 core, I needed to add a text input box using the FormHelper class like this :

$form->text('Blog.title', array('value'=>'', 'style'=>'width:200px;'));

//outputs: <input type="text" name="data[Blog][title]" id="BlogTitle" value="" style="width:200px;" />

 

Share:
facebook myspace digg del.icio.us fark stumbleupon live spurl furl reddit yahoo

COMMENTS (displaying 0 comments)

POST (leave a comment)

Name:
Email:
Message:
Verify:
CAPTCHA Image