49 public function __construct(
$name, $referenceEntity, $referenceFilter, $parameters = array())
51 parent::__construct(
$name);
53 if ($referenceEntity instanceof
Entity)
55 $this->refEntity = $referenceEntity;
56 $this->refEntityName = $referenceEntity->getFullName();
64 if (empty($referenceFilter))
69 $this->reference = $referenceFilter;
71 if (isset($parameters[
'join_type']))
73 $join_type = strtoupper($parameters[
'join_type']);
75 if (in_array($join_type, Join::getTypes(),
true))
77 $this->joinType = $join_type;
99 $remoteObjectClass = $this->getRefEntity()->getObjectClass();
101 if ($value !==
null && !($value instanceof $remoteObjectClass))
104 'Expected instance of `%s`, got `%s` instead', $remoteObjectClass, get_class($value)
108 return parent::validateValue($value, $primary, $row, $result);
128 if (!($this->reference instanceof Filter))
135 foreach ($this->reference->getConditions() as $condition)
138 || $condition->getOperator() !=
'='
145 $col1 = $condition->getColumn();
146 $col2 = $condition->getValue()->getDefinition();
148 $col1Flag = static::getElementalFlag($col1);
149 $col2Flag = static::getElementalFlag($col2);
151 if (($col1Flag + $col2Flag) == static::ELEMENTAL_BOTH)
154 $key = ($col1Flag == static::ELEMENTAL_THIS) ? $col1 : $col2;
155 $value = ($col1Flag == static::ELEMENTAL_REF) ? $col1 : $col2;
158 $key = substr($key, 5);
159 $value = substr($value, 4);
161 $elemental[$key] = $value;