Skip to content
Browse files

Merge branch '1.3-deprecation' into 1.3-misc

  • Loading branch information...
2 parents 71e93b9 + 3dc12cb commit 1bedd8418bf9b203ca278411fc37586e25046850 @markstory markstory committed
View
19 cake/libs/controller/components/cookie.php
@@ -1,6 +1,4 @@
<?php
-/* SVN FILE: $Id$ */
-
/**
* Short description for file.
*
@@ -9,20 +7,17 @@
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
- * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
- * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.controller.components
* @since CakePHP(tm) v 1.2.0.4213
- * @version $Revision$
- * @modifiedby $LastChangedBy$
- * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
@@ -277,6 +272,14 @@ function read($key = null) {
}
/**
+ * @deprecated use delete()
+ **/
+ function del($key) {
+ trigger_error('Deprecated method, use CookieComponent::delete instead', E_USER_WARNING);
+ return $this->delete($key);
+ }
+
+/**
* Delete a cookie value
*
* Optional [Name.], reguired key
@@ -289,7 +292,7 @@ function read($key = null) {
* @return void
* @access public
*/
- function del($key) {
+ function delete($key) {
if (empty($this->__values)) {
$this->read();
}
View
20 cake/libs/controller/components/session.php
@@ -1,6 +1,4 @@
<?php
-/* SVN FILE: $Id$ */
-
/**
* Short description for file.
*
@@ -9,20 +7,17 @@
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
- * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
- * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.controller.components
* @since CakePHP(tm) v 0.10.0.1232
- * @version $Revision$
- * @modifiedby $LastChangedBy$
- * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
if (!class_exists('cakesession')) {
@@ -167,15 +162,10 @@ function read($name = null) {
}
/**
- * Used to delete a session variable.
- *
- * In your controller: $this->Session->del('Controller.sessKey');
- *
- * @param string $name the name of the session key you want to delete
- * @return boolean true is session variable is set and can be deleted, false is variable was not set.
- * @access public
+ * @deprecated use delete
*/
function del($name) {
+ trigger_error('Deprecated method, use SessionComponent::delete instead', E_USER_WARNING);
if ($this->__active === true) {
$this->__start();
return parent::del($name);
@@ -195,7 +185,7 @@ function del($name) {
function delete($name) {
if ($this->__active === true) {
$this->__start();
- return $this->del($name);
+ return parent::del($name);
}
return false;
}
View
21 cake/libs/folder.php
@@ -1,26 +1,21 @@
<?php
-/* SVN FILE: $Id$ */
-
/**
* Convenience class for handling directories.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
- * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
- * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs
* @since CakePHP(tm) v 0.2.9
- * @version $Revision$
- * @modifiedby $LastChangedBy$
- * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
@@ -627,7 +622,7 @@ function copy($options = array()) {
}
if (!is_dir($toDir)) {
- $this->mkdir($toDir, $mode);
+ $this->create($toDir, $mode);
}
if (!is_writable($toDir)) {
@@ -725,9 +720,11 @@ function errors() {
* nix flavored alias
*
* @see read
+ * @deprecated use read
* @access public
*/
function ls($sort = true, $exceptions = false) {
+ trigger_error('Deprecated method, use Folder::read instead', E_USER_WARNING);
return $this->read($sort, $exceptions);
}
@@ -735,9 +732,11 @@ function ls($sort = true, $exceptions = false) {
* nix flavored alias
*
* @see create
+ * @deprecated use create
* @access public
*/
function mkdir($pathname, $mode = 0755) {
+ trigger_error('Deprecated method, use Folder::create instead', E_USER_WARNING);
return $this->create($pathname, $mode);
}
@@ -745,9 +744,11 @@ function mkdir($pathname, $mode = 0755) {
* nix flavored alias
*
* @see copy
+ * @deprecated use copy
* @access public
*/
function cp($options) {
+ trigger_error('Deprecated method, use Folder::copy instead', E_USER_WARNING);
return $this->copy($options);
}
@@ -755,9 +756,11 @@ function cp($options) {
* nix flavored alias
*
* @see move
+ * @deprecated use move
* @access public
*/
function mv($options) {
+ trigger_error('Deprecated method, use Folder::move instead', E_USER_WARNING);
return $this->move($options);
}
@@ -765,9 +768,11 @@ function mv($options) {
* nix flavored alias
*
* @see delete
+ * @deprecated use delete
* @access public
*/
function rm($path) {
+ trigger_error('Deprecated method, use Folder::delete instead', E_USER_WARNING);
return $this->delete($path);
}
View
6 cake/libs/model/model.php
@@ -499,9 +499,10 @@ function call__($method, $params) {
* @param boolean $permanent Set to true to make the binding permanent
* @return void
* @access public
- * @todo
+ * @deprecated Use Model::bindModel() instead.
*/
function bind($model, $options = array(), $permanent = true) {
+ trigger_error('Deprecated method, use Model::bindModel instead', E_USER_WARNING);
if (!is_array($model)) {
$model = array($model => $options);
}
@@ -1745,6 +1746,7 @@ function updateAll($fields, $conditions = true) {
* @link http://book.cakephp.org/view/691/remove
*/
function remove($id = null, $cascade = true) {
+ trigger_error('Deprecated method, use Model::delete instead', E_USER_WARNING);
return $this->delete($id, $cascade);
}
@@ -1798,6 +1800,7 @@ function delete($id = null, $cascade = true) {
* @deprecated
*/
function del($id = null, $cascade = true) {
+ trigger_error('Deprecated method, use Model::delete instead', E_USER_WARNING);
return $this->delete($id, $cascade);
}
@@ -2613,6 +2616,7 @@ function isForeignKey($field) {
* @deprecated
*/
function getDisplayField() {
+ trigger_error('Deprecated method, use Model::$displayField instead', E_USER_WARNING);
return $this->displayField;
}
View
7 cake/libs/view/helpers/javascript.php
@@ -609,14 +609,9 @@ function includeScript($script = "", $options = array()) {
*
* @param array $data Data to be converted
* @param array $options Set of options: block, prefix, postfix, stringKeys, quoteKeys, q
- * @param string $prefix DEPRECATED, use $options['prefix'] instead. Prepends the string to the returned data
- * @param string $postfix DEPRECATED, use $options['postfix'] instead. Appends the string to the returned data
- * @param array $stringKeys DEPRECATED, use $options['stringKeys'] instead. A list of array keys to be treated as a string
- * @param boolean $quoteKeys DEPRECATED, use $options['quoteKeys'] instead. If false, treats $stringKey as a list of keys *not* to be quoted
- * @param string $q DEPRECATED, use $options['q'] instead. The type of quote to use
* @return string A JSON code block
*/
- function object($data = array(), $options = array(), $prefix = null, $postfix = null, $stringKeys = null, $quoteKeys = null, $q = null) {
+ function object($data = array(), $options = array()) {
if (!empty($options) && !is_array($options)) {
$options = array('block' => $options);
} else if (empty($options)) {
View
23 cake/tests/cases/libs/controller/components/cookie.test.php
@@ -1,6 +1,4 @@
<?php
-/* SVN FILE: $Id$ */
-
/**
* CookieComponentTest file
*
@@ -9,20 +7,17 @@
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
- * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
- * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @since CakePHP(tm) v 1.2.0.5435
- * @version $Revision$
- * @modifiedby $LastChangedBy$
- * @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Controller', array('Component', 'Controller'), false);
@@ -182,9 +177,9 @@ function testWritePlainCookieArray() {
$this->assertEqual($this->Controller->Cookie->read('version'), '1.2.0.x');
$this->assertEqual($this->Controller->Cookie->read('tag'), 'CakePHP Rocks!');
- $this->Controller->Cookie->del('name');
- $this->Controller->Cookie->del('version');
- $this->Controller->Cookie->del('tag');
+ $this->Controller->Cookie->delete('name');
+ $this->Controller->Cookie->delete('version');
+ $this->Controller->Cookie->delete('tag');
}
/**
@@ -222,22 +217,22 @@ function testReadingCookieValue() {
* @return void
*/
function testDeleteCookieValue() {
- $this->Controller->Cookie->del('Encrytped_multi_cookies.name');
+ $this->Controller->Cookie->delete('Encrytped_multi_cookies.name');
$data = $this->Controller->Cookie->read('Encrytped_multi_cookies');
$expected = array('version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
$this->assertEqual($data, $expected);
- $this->Controller->Cookie->del('Encrytped_array');
+ $this->Controller->Cookie->delete('Encrytped_array');
$data = $this->Controller->Cookie->read('Encrytped_array');
$expected = array();
$this->assertEqual($data, $expected);
- $this->Controller->Cookie->del('Plain_multi_cookies.name');
+ $this->Controller->Cookie->delete('Plain_multi_cookies.name');
$data = $this->Controller->Cookie->read('Plain_multi_cookies');
$expected = array('version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
$this->assertEqual($data, $expected);
- $this->Controller->Cookie->del('Plain_array');
+ $this->Controller->Cookie->delete('Plain_array');
$data = $this->Controller->Cookie->read('Plain_array');
$expected = array();
$this->assertEqual($data, $expected);
View
40 cake/tests/cases/libs/controller/components/session.test.php
@@ -1,6 +1,4 @@
<?php
-/* SVN FILE: $Id$ */
-
/**
* SessionComponentTest file
*
@@ -9,20 +7,17 @@
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
- * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
- * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @since CakePHP(tm) v 1.2.0.5436
- * @version $Revision$
- * @modifiedby $LastChangedBy$
- * @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Controller', 'Controller', false);
@@ -247,24 +242,24 @@ function testSessionReadWrite() {
$this->assertTrue($Session->write('Test', 'some value'));
$this->assertEqual($Session->read('Test'), 'some value');
$this->assertFalse($Session->write('Test.key', 'some value'));
- $Session->del('Test');
+ $Session->delete('Test');
$this->assertTrue($Session->write('Test.key.path', 'some value'));
$this->assertEqual($Session->read('Test.key.path'), 'some value');
$this->assertEqual($Session->read('Test.key'), array('path' => 'some value'));
$this->assertTrue($Session->write('Test.key.path2', 'another value'));
$this->assertEqual($Session->read('Test.key'), array('path' => 'some value', 'path2' => 'another value'));
- $Session->del('Test');
+ $Session->delete('Test');
$array = array('key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3');
$this->assertTrue($Session->write('Test', $array));
$this->assertEqual($Session->read('Test'), $array);
- $Session->del('Test');
+ $Session->delete('Test');
$this->assertFalse($Session->write(array('Test'), 'some value'));
$this->assertTrue($Session->write(array('Test' => 'some value')));
$this->assertEqual($Session->read('Test'), 'some value');
- $Session->del('Test');
+ $Session->delete('Test');
Configure::write('Session.start', false);
$Session =& new SessionComponent();
@@ -275,27 +270,6 @@ function testSessionReadWrite() {
}
/**
- * testSessionDel method
- *
- * @access public
- * @return void
- */
- function testSessionDel() {
- $Session =& new SessionComponent();
-
- $this->assertFalse($Session->del('Test'));
-
- $Session->write('Test', 'some value');
- $this->assertTrue($Session->del('Test'));
-
- Configure::write('Session.start', false);
- $Session =& new SessionComponent();
- $Session->write('Test', 'some value');
- $this->assertFalse($Session->del('Test'));
- Configure::write('Session.start', true);
- }
-
-/**
* testSessionDelete method
*
* @access public
@@ -361,7 +335,7 @@ function testSessionFlash() {
$Session->setFlash('This is a test message', 'non_existing_layout');
$this->assertEqual($Session->read('Message.myFlash'), array('message' => 'This is a test message', 'layout' => 'default', 'params' => array()));
- $Session->del('Message');
+ $Session->delete('Message');
}
/**
View
19 cake/tests/cases/libs/folder.test.php
@@ -1,6 +1,4 @@
<?php
-/* SVN FILE: $Id$ */
-
/**
* FolderTest file
*
@@ -9,20 +7,17 @@
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
- * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
- * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
- * @version $Revision$
- * @modifiedby $LastChangedBy$
- * @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', 'File');
@@ -110,7 +105,7 @@ function testOperations() {
$this->assertTrue($result);
$copy = TMP . 'test_folder_copy';
- $result = $Folder->cp($copy);
+ $result = $Folder->copy($copy);
$this->assertTrue($result);
$copy = TMP . 'test_folder_copy';
@@ -125,7 +120,7 @@ function testOperations() {
$this->assertTrue($result);
$mv = TMP . 'test_folder_mv_2';
- $result = $Folder->mv($mv);
+ $result = $Folder->move($mv);
$this->assertTrue($result);
$result = $Folder->delete($new);
@@ -134,7 +129,7 @@ function testOperations() {
$result = $Folder->delete($mv);
$this->assertTrue($result);
- $result = $Folder->rm($mv);
+ $result = $Folder->delete($mv);
$this->assertTrue($result);
$new = APP . 'index.php';
@@ -452,7 +447,7 @@ function testFind() {
$Folder->cd(TMP);
$file = new File($Folder->pwd() . DS . 'paths.php', true);
- $Folder->mkdir($Folder->pwd() . DS . 'testme');
+ $Folder->create($Folder->pwd() . DS . 'testme');
$Folder->cd('testme');
$result = $Folder->find('paths\.php');
$expected = array();
@@ -493,7 +488,7 @@ function testFindRecursive() {
$this->assertIdentical($result, $expected);
$Folder->cd(TMP);
- $Folder->mkdir($Folder->pwd() . DS . 'testme');
+ $Folder->create($Folder->pwd() . DS . 'testme');
$Folder->cd('testme');
$File =& new File($Folder->pwd() . DS . 'paths.php');
$File->create();
View
14 cake/tests/cases/libs/model/behaviors/containable.test.php
@@ -57,17 +57,15 @@ function startTest() {
$this->Article =& ClassRegistry::init('Article');
$this->Tag =& ClassRegistry::init('Tag');
- $this->User->bind(array(
- 'Article' => array('type' => 'hasMany'),
- 'ArticleFeatured' => array('type' => 'hasMany'),
- 'Comment' => array('type' => 'hasMany')
- ));
+ $this->User->bindModel(array(
+ 'hasMany' => array('Article', 'ArticleFeatured', 'Comment')
+ ), false);
$this->User->ArticleFeatured->unbindModel(array('belongsTo' => array('Category')), false);
$this->User->ArticleFeatured->hasMany['Comment']['foreignKey'] = 'article_id';
- $this->Tag->bind(array(
- 'Article' => array('type' => 'hasAndBelongsToMany')
- ));
+ $this->Tag->bindModel(array(
+ 'hasAndBelongsToMany' => array('Article')
+ ), false);
$this->User->Behaviors->attach('Containable');
$this->Article->Behaviors->attach('Containable');
View
32 cake/tests/cases/libs/model/model_read.test.php
@@ -4519,25 +4519,39 @@ function testBindUnbind() {
);
$this->assertEqual($TestModel2->belongsTo['FeatureSet'], $expected);
- $TestModel2->bind('FeatureSet', array(
- 'conditions' => array('active' => true)
+ $TestModel2->bindModel(array(
+ 'belongsTo' => array(
+ 'FeatureSet' => array(
+ 'className' => 'FeatureSet',
+ 'conditions' => array('active' => true)
+ )
+ )
));
$expected['conditions'] = array('active' => true);
$this->assertEqual($TestModel2->belongsTo['FeatureSet'], $expected);
- $TestModel2->bind('FeatureSet', array(
- 'foreignKey' => false,
- 'conditions' => array('Feature.name' => 'DeviceType.name')
+ $TestModel2->bindModel(array(
+ 'belongsTo' => array(
+ 'FeatureSet' => array(
+ 'className' => 'FeatureSet',
+ 'foreignKey' => false,
+ 'conditions' => array('Feature.name' => 'DeviceType.name')
+ )
+ )
));
$expected['conditions'] = array('Feature.name' => 'DeviceType.name');
$expected['foreignKey'] = false;
$this->assertEqual($TestModel2->belongsTo['FeatureSet'], $expected);
- $TestModel2->bind('NewFeatureSet', array(
- 'type' => 'hasMany',
- 'className' => 'FeatureSet',
- 'conditions' => array('active' => true)
+ $TestModel2->bindModel(array(
+ 'hasMany' => array(
+ 'NewFeatureSet' => array(
+ 'className' => 'FeatureSet',
+ 'conditions' => array('active' => true)
+ )
+ )
));
+
$expected = array(
'className' => 'FeatureSet',
'conditions' => array('active' => true),
View
8 cake/tests/cases/libs/model/model_write.test.php
@@ -200,7 +200,9 @@ function testZeroDefaultFieldValue() {
function testNonNumericHabtmJoinKey() {
$this->loadFixtures('Post', 'Tag', 'PostsTag');
$Post =& new Post();
- $Post->bind('Tag', array('type' => 'hasAndBelongsToMany'));
+ $Post->bindModel(array(
+ 'hasAndBelongsToMany' => array('Tag')
+ ));
$Post->Tag->primaryKey = 'tag';
$result = $Post->find('all');
@@ -423,7 +425,7 @@ function testCounterCacheDecrease() {
$User = new CounterCacheUser();
$Post = new CounterCachePost();
- $Post->del(2);
+ $Post->delete(2);
$user = $User->find('first', array(
'conditions' => array('id' => 66),
'recursive' => -1
@@ -3086,7 +3088,7 @@ function testSaveAllHasOneValidation() {
$model->validate = array('comment' => 'notEmpty');
$model->Attachment->validate = array('attachment' => 'notEmpty');
- $model->Attachment->bind('Comment');
+ $model->Attachment->bindModel(array('belongsTo' => array('Comment')));
$this->assertFalse($model->saveAll(
array(

0 comments on commit 1bedd84

Please sign in to comment.
Something went wrong with that request. Please try again.