| @@ 149-169 (lines=21) @@ | ||
| 146 | /** |
|
| 147 | * {@inheritdoc} |
|
| 148 | */ |
|
| 149 | public function removeRootAssetMappings(Expression $expr) |
|
| 150 | { |
|
| 151 | $mappings = array(); |
|
| 152 | $hasListener = $this->dispatcher && $this->dispatcher->hasListeners(PuliEvents::POST_REMOVE_ASSET_MAPPING); |
|
| 153 | ||
| 154 | if ($hasListener) { |
|
| 155 | // Query the mappings for the event |
|
| 156 | $mappings = $this->findRootAssetMappings($expr); |
|
| 157 | } |
|
| 158 | ||
| 159 | $this->discoveryManager->removeRootBindingDescriptors($this->exprBuilder->buildExpression($expr)); |
|
| 160 | ||
| 161 | if ($hasListener) { |
|
| 162 | foreach ($mappings as $mapping) { |
|
| 163 | $this->dispatcher->dispatch( |
|
| 164 | PuliEvents::POST_REMOVE_ASSET_MAPPING, |
|
| 165 | new RemoveAssetMappingEvent($mapping) |
|
| 166 | ); |
|
| 167 | } |
|
| 168 | } |
|
| 169 | } |
|
| 170 | ||
| 171 | /** |
|
| 172 | * {@inheritdoc} |
|
| @@ 174-194 (lines=21) @@ | ||
| 171 | /** |
|
| 172 | * {@inheritdoc} |
|
| 173 | */ |
|
| 174 | public function clearRootAssetMappings() |
|
| 175 | { |
|
| 176 | $mappings = array(); |
|
| 177 | $hasListener = $this->dispatcher && $this->dispatcher->hasListeners(PuliEvents::POST_REMOVE_ASSET_MAPPING); |
|
| 178 | ||
| 179 | if ($hasListener) { |
|
| 180 | // Query the mappings for the event |
|
| 181 | $mappings = $this->getRootAssetMappings(); |
|
| 182 | } |
|
| 183 | ||
| 184 | $this->discoveryManager->removeRootBindingDescriptors($this->exprBuilder->buildExpression()); |
|
| 185 | ||
| 186 | if ($hasListener) { |
|
| 187 | foreach ($mappings as $mapping) { |
|
| 188 | $this->dispatcher->dispatch( |
|
| 189 | PuliEvents::POST_REMOVE_ASSET_MAPPING, |
|
| 190 | new RemoveAssetMappingEvent($mapping) |
|
| 191 | ); |
|
| 192 | } |
|
| 193 | } |
|
| 194 | } |
|
| 195 | ||
| 196 | /** |
|
| 197 | * {@inheritdoc} |
|