Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.6.0 Release #16504

Merged
merged 52 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
4e009e1
prepping changelog for 5.5.1
niden Dec 26, 2023
3debc43
removing 'order' from 'count()
niden Dec 26, 2023
ba5cac0
added tests
niden Dec 26, 2023
5a7d943
phpcs
niden Dec 26, 2023
91e37a5
updating changelog
niden Dec 26, 2023
a71fa61
fixing tests
niden Dec 26, 2023
1f9f4cf
minor adjustment
niden Dec 26, 2023
54fd67f
sqlite test correction
niden Dec 26, 2023
aca7e22
trying to fix this test again
niden Dec 26, 2023
458e4a9
trying to remove warnings from the run
niden Dec 26, 2023
93d302b
trying a different approach for the path
niden Dec 26, 2023
1214a26
maybe this syntax?
niden Dec 26, 2023
3281f92
changing inputs for actions
niden Dec 26, 2023
53b6096
another try
niden Dec 26, 2023
a874279
reverting back
niden Dec 26, 2023
f22fc27
removing local variable
niden Dec 26, 2023
34e1620
correcting variable name
niden Dec 26, 2023
a98908e
Merge pull request #16485 from niden/T16471-count-orderby
niden Dec 26, 2023
f521a8f
correcting links in readme
niden Dec 26, 2023
b6b0c8b
moved code to abstractadapter; set PDO stringify and emulate_prepares…
niden Dec 27, 2023
92f1fd7
refreshing ext
niden Dec 27, 2023
7c2456e
updating changelog
niden Dec 27, 2023
2f2f769
removed constructor - leaving things as they are with PDO
niden Dec 27, 2023
97f2c69
updating changelog
niden Dec 27, 2023
87039f7
adjusting test
niden Dec 27, 2023
043a91a
Merge pull request #16486 from niden/T16474-emulate-prepares
niden Dec 27, 2023
48d7102
Model::toArray added parameter to ignore getters
rudiservo Jan 4, 2024
7212ba0
Merge pull request #16491 from rudiservo/i16490-model-toarray-serialize
niden Jan 4, 2024
ffeb995
Added return type for getReusableRecords
Jan 5, 2024
f46bf4e
Removed property comments in Select
Jan 5, 2024
8793a7f
Merge branch '5.0.x' into manager-return-types
niden Jan 5, 2024
750f56c
Merge pull request #16493 from kuhler-Stratege/manager-return-types
niden Jan 5, 2024
4a0a419
Merge pull request #16494 from kuhler-Stratege/select-delete-property…
niden Jan 5, 2024
7228f4d
documentation corrections and test addition
niden Dec 30, 2023
5da0657
mostly docblock corrections; returning self from datamapper
niden Jan 6, 2024
7dde460
correcting return types for reset
niden Jan 6, 2024
cbfb63a
reverting return types for datamapper
niden Jan 6, 2024
34b0acd
correcting return type for select
niden Jan 6, 2024
c2cf8e0
fixed apcu_* methods to ignore referenced values
niden Jan 6, 2024
3c13ddb
regenerating ext and build
niden Jan 6, 2024
9bb774a
Merge pull request #16497 from niden/T16489-apcu-fetch-2
Jeckerson Jan 7, 2024
379040f
reworking the toarray conditionals
niden Jan 9, 2024
d9be887
Merge pull request #16499 from niden/T16498-model-toarray-segfault
niden Jan 9, 2024
9606bfa
bumping version
niden Jan 9, 2024
a2222ee
updating version
niden Jan 9, 2024
087e70d
refreshing ext
niden Jan 9, 2024
28c9a04
Merge pull request #16500 from niden/5.0.x
Jeckerson Jan 9, 2024
18a9ac7
bumping to 5.6
niden Jan 9, 2024
c21137d
regenerating ext
niden Jan 9, 2024
e0c7f8e
updating changelog
niden Jan 9, 2024
eb1c97d
updating package description
niden Jan 9, 2024
feaa3de
Merge pull request #16503 from niden/5.0.x
niden Jan 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
documentation corrections and test addition
  • Loading branch information
niden committed Jan 6, 2024
commit 7228f4df8f4df129feb99419ec86a1aa22c19a46
41 changes: 41 additions & 0 deletions phalcon/DataMapper/Query/AbstractQuery.zep
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,47 @@ abstract class AbstractQuery
this->store["WHERE"] = [];
}

public function resetColumns()
{
let this->store["COLUMNS"] = [];
}

public function resetFrom()
{
let this->store["FROM"] = [];
}

public function resetWhere()
{
let this->store["WHERE"] = [];
}

public function resetGroupBy()
{
let this->store["GROUP"] = [];
}

public function resetHaving()
{
let this->store["HAVING"] = [];
}

public function resetOrderBy()
{
let this->store["ORDER"] = [];
}

public function resetLimit()
{
let this->store["LIMIT"] = 0,
this->store["OFFSET"] = 0;
}

public function resetFlags()
{
let this->store["FLAGS"] = [];
}

/**
* Builds the flags statement(s)
*
Expand Down
12 changes: 6 additions & 6 deletions phalcon/Filter/Validation/Validator/Uniqueness.zep
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ class Uniqueness extends AbstractCombinedFieldsValidator
/**
* Constructor
*
* @param array options = [
* 'message' => '',
* 'template' => '',
* @param array $options = [
* 'message' => '',
* 'template' => '',
* 'allowEmpty' => false,
* 'convert' => null,
* 'model' => null,
* 'except' => null
* 'convert' => null,
* 'model' => null,
* 'except' => null
* ]
*/
public function __construct(array! options = [])
Expand Down
35 changes: 33 additions & 2 deletions phalcon/Mvc/Model/Criteria.zep
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,49 @@ class Criteria implements CriteriaInterface, InjectionAwareInterface
}

/**
* Sets the columns to be queried
* Sets the columns to be queried. The columns can be either a `string` or
* an `array`. The string can specify one or more columns, separated by
* commas, the same way that one uses the SQL select statement. You can
* use aliases, aggregate functions etc. If you need to reference other
* models you will need to reference them with their namespaces.
*
* When using an array as a parameter, you will need to specify one field
* per element. If a key is defined in our array, it will be used as the
* alias in the query
*
*```php
* <?php
*
* // String, comma separated values
* $criteria->columns("id, name");
*
* // Array, one column per element
* $criteria->columns(
* [
* "id",
* "name",
* ]
* );
*
* // Array, named keys. The name of the key acts as an alias (`AS` clause)
* $criteria->columns(
* [
* "name",
* "number" => "COUNT(*)",
* ]
* );
*
* // Different models
* $criteria->columns(
* [
* "\Phalcon\Models\Invoices.*",
* "\Phalcon\Models\Customers.cst_name_first",
* "\Phalcon\Models\Customers.cst_name_last",
* ]
* );
*```
*
* @param string|array columns
* @param string|array $columns
*/
public function columns(var columns) -> <CriteriaInterface>
{
Expand Down
26 changes: 25 additions & 1 deletion phalcon/Mvc/Model/Query/Builder.zep
Original file line number Diff line number Diff line change
Expand Up @@ -447,25 +447,49 @@ class Builder implements BuilderInterface, InjectionAwareInterface
}

/**
* Sets the columns to be queried
* Sets the columns to be queried. The columns can be either a `string` or
* an `array`. The string can specify one or more columns, separated by
* commas, the same way that one uses the SQL select statement. You can
* use aliases, aggregate functions etc. If you need to reference other
* models you will need to reference them with their namespaces.
*
* When using an array as a parameter, you will need to specify one field
* per element. If a key is defined in our array, it will be used as the
* alias in the query
*
*```php
* <?php
*
* // String, comma separated values
* $builder->columns("id, name");
*
* // Array, one column per element
* $builder->columns(
* [
* "id",
* "name",
* ]
* );
*
* // Array, named keys. The name of the key acts as an alias (`AS` clause)
* $builder->columns(
* [
* "name",
* "number" => "COUNT(*)",
* ]
* );
*
* // Different models
* $builder->columns(
* [
* "\Phalcon\Models\Invoices.*",
* "\Phalcon\Models\Customers.cst_name_first",
* "\Phalcon\Models\Customers.cst_name_last",
* ]
* );
*```
*
* @param string|array $columns
*/
public function columns(var columns) -> <BuilderInterface>
{
Expand Down
44 changes: 42 additions & 2 deletions phalcon/Mvc/Model/Query/BuilderInterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,49 @@ interface BuilderInterface
public function betweenWhere(string! expr, minimum, maximum, string! operator = BuilderInterface::OPERATOR_AND) -> <BuilderInterface>;

/**
* Sets the columns to be queried
* Sets the columns to be queried. The columns can be either a `string` or
* an `array`. The string can specify one or more columns, separated by
* commas, the same way that one uses the SQL select statement. You can
* use aliases, aggregate functions etc. If you need to reference other
* models you will need to reference them with their namespaces.
*
* @param string|array columns
* When using an array as a parameter, you will need to specify one field
* per element. If a key is defined in our array, it will be used as the
* alias in the query
*
*```php
* <?php
*
* // String, comma separated values
* $builder->columns("id, name");
*
* // Array, one column per element
* $builder->columns(
* [
* "id",
* "name",
* ]
* );
*
* // Array, named keys. The name of the key acts as an alias (`AS` clause)
* $builder->columns(
* [
* "name",
* "number" => "COUNT(*)",
* ]
* );
*
* // Different models
* $builder->columns(
* [
* "\Phalcon\Models\Invoices.*",
* "\Phalcon\Models\Customers.cst_name_first",
* "\Phalcon\Models\Customers.cst_name_last",
* ]
* );
*```
*
* @param string|array $columns
*/
public function columns(columns) -> <BuilderInterface>;

Expand Down
3 changes: 2 additions & 1 deletion phalcon/Mvc/Model/Resultset/Complex.zep
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ class Complex extends Resultset implements ResultsetInterface
}

/**
* Serializing a resultset will dump all related rows into a big array
* Serializing a resultset will dump all related rows into a big array,
* serialize it and return the resulting string
*/
public function serialize() -> string
{
Expand Down
56 changes: 53 additions & 3 deletions phalcon/Mvc/View/Engine/Volt/Compiler.zep
Original file line number Diff line number Diff line change
Expand Up @@ -1144,9 +1144,59 @@ class Compiler implements InjectionAwareInterface
}

/**
* Compiles a "set" statement returning PHP code
*
* @param array statement
* Compiles a "set" statement returning PHP code. The method accepts an
* array produced by the Volt parser and creates the `set` statement in PHP.
* This method is not particularly useful in development, since it requires
* advanced knowledge of the Volt parser.
*
* ```php
* <?php
*
* use Phalcon\Mvc\View\Engine\Volt\Compiler;
*
* $compiler = new Compiler();
*
* // {% set a = ['first': 1] %}

* $source = [
* "type" => 306,
* "assignments" => [
* [
* "variable" => [
* "type" => 265,
* "value" => "a",
* "file" => "eval code",
* "line" => 1
* ],
* "op" => 61,
* "expr" => [
* "type" => 360,
* "left" => [
* [
* "expr" => [
* "type" => 258,
* "value" => "1",
* "file" => "eval code",
* "line" => 1
* ],
* "name" => "first",
* "file" => "eval code",
* "line" => 1
* ]
* ],
* "file" => "eval code",
* "line" => 1
* ],
* "file" => "eval code",
* "line" => 1
* ]
* ]
* ];
*
* echo $compiler->compileSet($source);
* // <?php $a = ['first' => 1]; ?>";
*
* @param array $statement
*
* @throws \Phalcon\Mvc\View\Engine\Volt\Exception
* @return string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Phalcon\Tests\Integration\Mvc\View\Engine\Volt\Compiler;

use IntegrationTester;
use Phalcon\Mvc\View\Engine\Volt\Compiler;

/**
* Class CompileSetCest
Expand All @@ -29,6 +30,68 @@ class CompileSetCest
public function mvcViewEngineVoltCompilerCompileSet(IntegrationTester $I)
{
$I->wantToTest('Mvc\View\Engine\Volt\Compiler - compileSet()');
$I->skipTest('Need implementation');

$volt = new Compiler();

$source = [
"type" => 306,
"assignments" => [
[
"variable" => [
"type" => 265,
"value" => "a",
"file" => "eval code",
"line" => 1
],
"op" => 61,
"expr" => [
"type" => 360,
"left" => [
[
"expr" => [
"type" => 258,
"value" => "1",
"file" => "eval code",
"line" => 1
],
"name" => "first",
"file" => "eval code",
"line" => 1
],
[
"expr" => [
"type" => 258,
"value" => "2",
"file" => "eval code",
"line" => 1
],
"name" => "second",
"file" => "eval code",
"line" => 1
],
[
"expr" => [
"type" => 258,
"value" => "3",
"file" => "eval code",
"line" => 1
],
"name" => "third",
"file" => "eval code",
"line" => 1
]
],
"file" => "eval code",
"line" => 1
],
"file" => "eval code",
"line" => 1
]
]
];

$expected = "<?php \$a = ['first' => 1, 'second' => 2, 'third' => 3]; ?>";
$actual = $volt->compileSet($source);
$I->assertSame($expected, $actual);
}
}