Skip to content

Commit

Permalink
(re)Fix Field definition for field not found if field name starts wit…
Browse files Browse the repository at this point in the history
…h upper case

Resolves #369

Directly assign the key in the case where the "Direct" target strategy is used alongside with "SYSTEM Key".

Currently, an error is thrown because `key` is not in `$this->fieldName` since it is a system field
  • Loading branch information
SamyMP authored and dvesh3 committed Nov 23, 2023
1 parent 186a84f commit 5666dc2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Mapping/DataTarget/Direct.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public function assignData(ElementInterface $element, $data): void
{
$setterParts = explode('.', $this->fieldName);

if (count($setterParts) === 1) {
if ($this->fieldName === 'key') {
$this->doAssignData($element, $this->fieldName, $data);
} elseif (count($setterParts) === 1) {
//direct class attribute
$getter = 'get' . ucfirst($this->fieldName);
if (!$this->checkAssignData($data, $element, $getter)) {
Expand Down

0 comments on commit 5666dc2

Please sign in to comment.