Skip to content

Commit de0aae8

Browse files
sergeyklaychilimatic
authored andcommitted
Removed no longer used "_with" variable from the QueryBuilder
This feature was introduced at [Jun 1, 2015][1] was removed at [Aug 6, 2015][2]. Actually this feature was never used in stable releases. Mark this feature as deprecated to avoid misunderstandings for future developers. [1]: phalcon@3e43192 [2]: phalcon@3ca2504
1 parent d72264e commit de0aae8

File tree

4 files changed

+15
-25
lines changed

4 files changed

+15
-25
lines changed

CHANGELOG-3.2.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Fixed `Phalcon\Validation\Validator\File::validate` to work properly with parameter 'message' [#12947](https://github.com/phalcon/cphalcon/issues/12947)
55
- Fixed `Phalcon\Mvc\View::render` to render a view with params [#13046](https://github.com/phalcon/cphalcon/issues/13046)
66
- Fixed `Phalcon\Mvc\Model\Manager::getRelationRecords` to work properly with provided columns [#12972](https://github.com/phalcon/cphalcon/issues/12972)
7+
- Mark as deprecated no longer used `Phalcon\Mvc\Model\Query\Builder::$_with` parameter [#13023](https://github.com/phalcon/cphalcon/issues/13023)
78

89
# [3.2.2](https://github.com/phalcon/cphalcon/releases/tag/v3.2.2) (2017-08-14)
910
- Fixed `Phalcon\Db\Adapter\Pdo\Postgresql::describeColumns` to work properly with `DOUBLE PRECISION` and `REAL` data types [#12842](https://github.com/phalcon/cphalcon/issues/12842)

phalcon/mvc/model/query/builder.zep

+13-23
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ class Builder implements BuilderInterface, InjectionAwareInterface
7171

7272
protected _joins;
7373

74+
/**
75+
* @deprecated Will be removed in version 4.0.0
76+
*/
7477
protected _with;
7578

7679
protected _conditions;
@@ -107,7 +110,7 @@ class Builder implements BuilderInterface, InjectionAwareInterface
107110
singleConditionArray, limit, offset, fromClause,
108111
mergedConditions, mergedParams, mergedTypes,
109112
singleCondition, singleParams, singleTypes,
110-
with, distinct, bind, bindTypes;
113+
distinct, bind, bindTypes;
111114

112115
if typeof params == "array" {
113116

@@ -199,13 +202,6 @@ class Builder implements BuilderInterface, InjectionAwareInterface
199202
let this->_joins = joinsClause;
200203
}
201204

202-
/**
203-
* Check if the resultset must be eager loaded
204-
*/
205-
if fetch with, params["with"] {
206-
let this->_with = with;
207-
}
208-
209205
/**
210206
* Assign GROUP clause
211207
*/
@@ -389,33 +385,27 @@ class Builder implements BuilderInterface, InjectionAwareInterface
389385
/**
390386
* Add a model to take part of the query
391387
*
388+
* NOTE: The third parameter $with is deprecated and will be removed in future releases.
389+
*
392390
*<code>
393391
* // Load data from models Robots
394392
* $builder->addFrom("Robots");
395393
*
396394
* // Load data from model 'Robots' using 'r' as alias in PHQL
397395
* $builder->addFrom("Robots", "r");
398-
*
399-
* // Load data from model 'Robots' using 'r' as alias in PHQL
400-
* // and eager load model 'RobotsParts'
401-
* $builder->addFrom("Robots", "r", "RobotsParts");
402-
*
403-
* // Load data from model 'Robots' using 'r' as alias in PHQL
404-
* // and eager load models 'RobotsParts' and 'Parts'
405-
* $builder->addFrom(
406-
* "Robots",
407-
* "r",
408-
* [
409-
* "RobotsParts",
410-
* "Parts",
411-
* ]
412-
* );
413396
*</code>
414397
*/
415398
public function addFrom(var model, var alias = null, var with = null) -> <Builder>
416399
{
417400
var models, currentModel;
418401

402+
if typeof with != "null" {
403+
trigger_error(
404+
"The third parameter 'with' is deprecated and will be removed in future releases.",
405+
E_DEPRECATED
406+
);
407+
}
408+
419409
let models = this->_models;
420410
if typeof models != "array" {
421411
if typeof models != "null" {

tests/_support/Helper/Db/Connection/AbstractFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
abstract class AbstractFactory
1111
{
1212
/**
13-
* Creates database connection
13+
* Creates a database connection
1414
*
1515
* @return \Phalcon\Db\Adapter\Pdo
1616
*/

tests/unit/Mvc/Model/MetaData/ResetCest.php

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Phalcon\Test\Unit\Mvc\Model\MetaData;
44

5-
use Phalcon\Di;
65
use UnitTester;
76
use Phalcon\Mvc\Model;
87
use Codeception\Example;

0 commit comments

Comments
 (0)