Skip to content

Commit

Permalink
Fix Field definition for field not found if field name starts with up…
Browse files Browse the repository at this point in the history
…per case - resolves #369
  • Loading branch information
dvesh3 committed Nov 9, 2023
1 parent 4e86244 commit b4d745e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Mapping/DataTarget/Direct.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ protected function doAssignData($valueContainer, $fieldName, $data)
* @param string $getter
*
* @return bool
* @throws InvalidConfigurationException
*/
protected function checkAssignData($newData, $valueContainer, $getter)
{
Expand All @@ -138,7 +139,13 @@ protected function checkAssignData($newData, $valueContainer, $getter)
$currentData = $valueContainer->$getter($this->language);
DataObject::setHideUnpublished($hideUnpublished);

$fieldName = lcfirst(str_replace('get', '', $getter));
$fieldName = $this->fieldName;
//brick attribute
$fieldNameParts = explode('.', $this->fieldName);
if (count($fieldNameParts) === 3) {
$fieldName = $fieldNameParts[2];
}

$fieldDefinition = $this->getFieldDefinition($valueContainer, $fieldName);
if ($this->writeIfTargetIsNotEmpty === false && !$fieldDefinition->isEmpty($currentData)) {
return false;
Expand Down

0 comments on commit b4d745e

Please sign in to comment.