| @@ 135-154 (lines=20) @@ | ||
| 132 | * @param $object |
|
| 133 | * @return bool |
|
| 134 | */ |
|
| 135 | protected function setReferences($object) |
|
| 136 | { |
|
| 137 | if (!array_key_exists('references', $this->dsl)) { |
|
| 138 | return false; |
|
| 139 | } |
|
| 140 | ||
| 141 | foreach ($this->dsl['references'] as $reference) { |
|
| 142 | switch ($reference['attribute']) { |
|
| 143 | case 'id': |
|
| 144 | $value = $object->id; |
|
| 145 | break; |
|
| 146 | default: |
|
| 147 | throw new \InvalidArgumentException('Tag Manager does not support setting references for attribute ' . $reference['attribute']); |
|
| 148 | } |
|
| 149 | ||
| 150 | $this->referenceResolver->addReference($reference['identifier'], $value); |
|
| 151 | } |
|
| 152 | ||
| 153 | return true; |
|
| 154 | } |
|
| 155 | } |
|
| 156 | ||
| @@ 169-189 (lines=21) @@ | ||
| 166 | * {@inheritdoc} |
|
| 167 | * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectState $objectState |
|
| 168 | */ |
|
| 169 | protected function setReferences($objectState) |
|
| 170 | { |
|
| 171 | if (!array_key_exists('references', $this->dsl)) { |
|
| 172 | return false; |
|
| 173 | } |
|
| 174 | ||
| 175 | foreach ($this->dsl['references'] as $reference) { |
|
| 176 | switch ($reference['attribute']) { |
|
| 177 | case 'object_state_id': |
|
| 178 | case 'id': |
|
| 179 | $value = $objectState->id; |
|
| 180 | break; |
|
| 181 | default: |
|
| 182 | throw new \InvalidArgumentException('Object State Manager does not support setting references for attribute ' . $reference['attribute']); |
|
| 183 | } |
|
| 184 | ||
| 185 | $this->referenceResolver->addReference($reference['identifier'], $value); |
|
| 186 | } |
|
| 187 | ||
| 188 | return true; |
|
| 189 | } |
|
| 190 | ||
| 191 | /** |
|
| 192 | * @param array $matchCondition |
|