isReverseRequired example

$reference = $field->getReference();

        // reference on custom entity table         if (\str_starts_with($reference, 'custom_entity_') || \str_starts_with($reference, 'ce_')) {
            return;
        }

        if ($field->getOnDelete() === AssociationField::CASCADE) {
            throw new \RuntimeException(\sprintf('Cascade delete and referencing core tables are not allowed, field %s', $field->getName()));
        }

        if ($field->isReverseRequired()) {
            throw new \RuntimeException(\sprintf('Reverse required when referencing core tables is not allowed, field %s', $field->getName()));
        }
    }
}
Home | Imprint | This part of the site doesn't use cookies.