diff --git a/doc/82-Changelog.md b/doc/82-Changelog.md index e11bd916..e3d9a868 100644 --- a/doc/82-Changelog.md +++ b/doc/82-Changelog.md @@ -59,6 +59,7 @@ before switching to a new version. * FEATURE: UTF8 validation for failed imports gives better error message (#2143) * FEATURE: ArrayByElementPosition now allows filtering by key name (#1721) * FEATURE: Use your Director Objects as an Import Source (#2198) +* FEATURE: Property modifiers are now granted access the current Property Name (#2241) * FIX: Import Source preview now catches all errors * FIX: Import Source download sends eventual errors as a valid JSON result * FIX: LDAP Import is now able to paginate limited results (#2019) diff --git a/library/Director/Hook/PropertyModifierHook.php b/library/Director/Hook/PropertyModifierHook.php index 93f1157e..5d8736d6 100644 --- a/library/Director/Hook/PropertyModifierHook.php +++ b/library/Director/Hook/PropertyModifierHook.php @@ -13,6 +13,9 @@ abstract class PropertyModifierHook /** @var string */ private $targetProperty; + /** @var string */ + private $propertyName; + /** @var Db */ private $db; @@ -143,6 +146,24 @@ abstract class PropertyModifierHook return $this; } + /** + * @return string + */ + public function getPropertyName() + { + return $this->propertyName; + } + + /** + * @param string $propertyName + * @return $this + */ + public function setPropertyName($propertyName) + { + $this->propertyName = $propertyName; + return $this; + } + /** * The desired target property. Modifiers might want to have their outcome * written to another property of the current row. diff --git a/library/Director/Objects/ImportRowModifier.php b/library/Director/Objects/ImportRowModifier.php index 2b0d8cc9..f3022ed7 100644 --- a/library/Director/Objects/ImportRowModifier.php +++ b/library/Director/Objects/ImportRowModifier.php @@ -46,6 +46,7 @@ class ImportRowModifier extends DbObjectWithSettings } $obj = new $class; $obj->setSettings($this->getSettings()); + $obj->setPropertyName($this->get('property_name')); $obj->setTargetProperty($this->get('target_property')); $obj->setDb($this->connection); $this->hookInstance = $obj;