Skip to content

Commit

Permalink
[phalcon#14485] ignore_unknown_columns global is respected by update …
Browse files Browse the repository at this point in the history
…and insert
  • Loading branch information
CameronHall committed Oct 24, 2019
1 parent 8f5238b commit 5eb891f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
- Fixed `Phalcon\Translate\*` aligning `parameters` as `array` with the interpolator calls. [#14477](https://github.com/phalcon/cphalcon/pull/14477)
- Fixed `Phalcon\Storage\AdapterFactory:newInstance` to return the correct interface [#14481](https://github.com/phalcon/cphalcon/issues/14481)
- Fixed `Phalcon\Mvc\Dispatcher:forward` to accept an array vs a mixed variable [#14481](https://github.com/phalcon/cphalcon/issues/14481)
- Fixed `Phalcon\Mvc\Model::_doLowUpdate` and `Phalcon\Mvc\Model::_doLowInsert` throwing errors about column mapping when `phalcon.orm.ignore_unknown_columns` is set `On` [#14485](https://github.com/phalcon/cphalcon/issues/14485)

## Removed
- Removed `Phalcon\Application\AbstractApplication::handle()` as it does not serve any purpose and causing issues with type hinting. [#14407](https://github.com/phalcon/cphalcon/pull/14407)
Expand Down
16 changes: 10 additions & 6 deletions phalcon/Mvc/Model.zep
Original file line number Diff line number Diff line change
Expand Up @@ -3715,9 +3715,11 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface,
*/
if typeof columnMap == "array" {
if unlikely !fetch attributeField, columnMap[field] {
throw new Exception(
"Column '" . field . "' isn't part of the column map"
);
if unlikely !globals_get("orm.ignore_unknown_columns") {
throw new Exception(
"Column '" . field . "' isn't part of the column map"
);
}
}
} else {
let attributeField = field;
Expand Down Expand Up @@ -4437,9 +4439,11 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface,
for field in notNull {
if typeof columnMap == "array" {
if unlikely !fetch attributeField, columnMap[field] {
throw new Exception(
"Column '" . field . "' isn't part of the column map"
);
if unlikely !globals_get("orm.ignore_unknown_columns") {
throw new Exception(
"Column '" . field . "' isn't part of the column map"
);
}
}
} else {
let attributeField = field;
Expand Down

0 comments on commit 5eb891f

Please sign in to comment.