Skip to content

Commit

Permalink
Merge pull request #16516 from niden/T16514-find-with-source
Browse files Browse the repository at this point in the history
T16514 find with source
  • Loading branch information
niden authored Jan 18, 2024
2 parents 101fbf2 + d2ea714 commit 96d18ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

- Fixed `Phalcon\Db\Adapter\Pdo\Postgresql::describeColumns()` to return the correct string back [#16371](https://github.com/phalcon/cphalcon/issues/16371)
- Fixed `Phalcon/Filter/Validation::validate()` and `Phalcon/Filter/Validation/ValidationInterface::validate()` to return also `bool` [#16337](https://github.com/phalcon/cphalcon/issues/16337)
- Fixed `Phalcon\Mvc\Model::toArray` to ignore getters when the field name is `source`. [#16514](https://github.com/phalcon/cphalcon/issues/16514)

### Removed

Expand Down
4 changes: 2 additions & 2 deletions phalcon/Cache/AbstractCache.zep
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ abstract class AbstractCache implements CacheInterface
* @throws InvalidArgumentException MUST be thrown if the $key string is
* not a legal value.
*/
protected function doGet(string key, var defaultValue = null)
protected function doGet(string key, var defaultValue = null) -> var
{
this->checkKey(key);

Expand All @@ -154,7 +154,7 @@ abstract class AbstractCache implements CacheInterface
/**
* Obtains multiple cache items by their unique keys.
*/
protected function doGetMultiple(var keys, var defaultValue = null)
protected function doGetMultiple(var keys, var defaultValue = null) -> array
{
var element, results;

Expand Down
5 changes: 4 additions & 1 deletion phalcon/Mvc/Model.zep
Original file line number Diff line number Diff line change
Expand Up @@ -3328,7 +3328,10 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface,
*/
let method = "get" . camelize(attributeField);

if true === useGetter && method_exists(this, method) {
/**
* Do not use the getter if the field name is `source` (getSource)
*/
if true === useGetter && "getSource" !== method && method_exists(this, method) {
let data[attributeField] = this->{method}();
} elseif isset(this->{attributeField}) {
let data[attributeField] = this->{attributeField};
Expand Down

0 comments on commit 96d18ec

Please sign in to comment.