From 86b613eb55caea9e89ecd68a8cd03447d6f6cd4b Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 6 Nov 2015 09:50:06 +0100 Subject: [PATCH] SyncProperty: add source column helper methods --- library/Director/Objects/SyncProperty.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/library/Director/Objects/SyncProperty.php b/library/Director/Objects/SyncProperty.php index 980cdc0d..ec916032 100644 --- a/library/Director/Objects/SyncProperty.php +++ b/library/Director/Objects/SyncProperty.php @@ -28,4 +28,18 @@ class SyncProperty extends DbObject $this->source_expression = '${' . $value . '}'; return $this; } + + public function sourceIsSingleColumn() + { + return $this->getSourceColumn() !== null; + } + + public function getSourceColumn() + { + if (preg_match('/^\${([A-Za-z0-9_-]+)}$/', $this->source_expression, $m)) { + return $m[1]; + } + + return null; + } }