addDependency('metadata'); $this->addDependency('container'); } protected function getMetadata() { return $this->getInjection('metadata'); } protected function getWebhookManager() { return $this->getInjection('container')->get('webhookManager'); } public function afterSave(Entity $entity, array $options = []) { if (!empty($options['silent'])) return; if (!$this->getMetadata()->get(['scopes', $entity->getEntityType(), 'object'])) return; if ($entity->isNew()) { $this->getWebhookManager()->processCreate($entity); } else { $this->getWebhookManager()->processUpdate($entity); } } public function afterRemove(Entity $entity, array $options = []) { if (!empty($options['silent'])) return; if (!$this->getMetadata()->get(['scopes', $entity->getEntityType(), 'object'])) return; $this->getWebhookManager()->processDelete($entity); } }