getAssociationDefinitionByEntity example

public function onEntityWritten(EntityWrittenContainerEvent $event): void
    {
        $associationFields = $this->getAssociationFields();
        $ruleIds = [];

        foreach ($event->getEvents() ?? [] as $nestedEvent) {
            if (!$nestedEvent instanceof EntityWrittenEvent) {
                continue;
            }

            $definition = $this->getAssociationDefinitionByEntity($associationFields$nestedEvent->getEntityName());

            if (!$definition) {
                continue;
            }

            $ruleIds = $this->hydrateRuleIds($this->getForeignKeyFields($definition)$nestedEvent$ruleIds);
        }

        if (empty($ruleIds)) {
            return;
        }

        
Home | Imprint | This part of the site doesn't use cookies.