From 675f828e163b069a60e69ae11734d4b835e88513 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 18 Aug 2013 21:37:37 -0400 Subject: [PATCH] Remove insertQuery and deleteQuery. These properties were never implemented and are misleading when people try to use them. Closes #3997 --- lib/Cake/Console/Templates/default/classes/model.ctp | 2 -- lib/Cake/Model/Behavior/ContainableBehavior.php | 2 +- lib/Cake/Model/Model.php | 6 +++--- lib/Cake/Test/Case/Model/ModelIntegrationTest.php | 4 +--- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/Cake/Console/Templates/default/classes/model.ctp b/lib/Cake/Console/Templates/default/classes/model.ctp index f958dd954..28f55b91c 100644 --- a/lib/Cake/Console/Templates/default/classes/model.ctp +++ b/lib/Cake/Console/Templates/default/classes/model.ctp @@ -169,8 +169,6 @@ if (!empty($associations['hasAndBelongsToMany'])): $out .= "\t\t\t'limit' => '',\n"; $out .= "\t\t\t'offset' => '',\n"; $out .= "\t\t\t'finderQuery' => '',\n"; - $out .= "\t\t\t'deleteQuery' => '',\n"; - $out .= "\t\t\t'insertQuery' => ''\n"; $out .= "\t\t)"; if ($i + 1 < $habtmCount) { $out .= ","; diff --git a/lib/Cake/Model/Behavior/ContainableBehavior.php b/lib/Cake/Model/Behavior/ContainableBehavior.php index 6fb2121cd..06e636b38 100644 --- a/lib/Cake/Model/Behavior/ContainableBehavior.php +++ b/lib/Cake/Model/Behavior/ContainableBehavior.php @@ -269,7 +269,7 @@ class ContainableBehavior extends ModelBehavior { * @return array Containments */ public function containments(Model $Model, $contain, $containments = array(), $throwErrors = null) { - $options = array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery', 'deleteQuery', 'insertQuery'); + $options = array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery'); $keep = array(); if ($throwErrors === null) { $throwErrors = (empty($this->settings[$Model->alias]) ? true : $this->settings[$Model->alias]['notices']); diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 385890a87..67289c151 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -464,8 +464,8 @@ class Model extends Object implements CakeEventListener { * - `limit`: The maximum number of associated rows you want returned. * - `offset`: The number of associated rows to skip over (given the current * conditions and order) before fetching and associating. - * - `finderQuery`, `deleteQuery`, `insertQuery`: A complete SQL query CakePHP - * can use to fetch, delete, or create new associated model records. This should + * - `finderQuery`, A complete SQL query CakePHP + * can use to fetch associated model records. This should * be used in situations that require very custom results. * * @var array @@ -555,7 +555,7 @@ class Model extends Object implements CakeEventListener { 'belongsTo' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'counterCache'), 'hasOne' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'dependent'), 'hasMany' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'dependent', 'exclusive', 'finderQuery', 'counterQuery'), - 'hasAndBelongsToMany' => array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery', 'deleteQuery', 'insertQuery') + 'hasAndBelongsToMany' => array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery') ); /** diff --git a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php index 1ab298c04..ff7e52d8e 100644 --- a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php +++ b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php @@ -1491,7 +1491,7 @@ class ModelIntegrationTest extends BaseModelTest { 'dynamicWith' => true, 'associationForeignKey' => 'join_b_id', 'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '', - 'finderQuery' => '', 'deleteQuery' => '', 'insertQuery' => '' + 'finderQuery' => '' )); $this->assertEquals($expected, $result); @@ -1568,8 +1568,6 @@ class ModelIntegrationTest extends BaseModelTest { 'offset' => '', 'unique' => true, 'finderQuery' => '', - 'deleteQuery' => '', - 'insertQuery' => '' )); $this->assertSame($TestModel->hasAndBelongsToMany, $expected);