magicbart/external-reference-bundle

This package is abandoned and no longer maintained. The author suggests using the projet-normandie/external-reference-bundle package instead.

Add external reference between api and entity

dev-dev 2025-03-11 18:58 UTC

This package is auto-updated.

Last update: 2025-03-22 06:06:00 UTC


README

ExternalReferenceBundle is a Symfony bundle that provides a mechanism for storing and managing external references for objects created via external APIs. This bundle allows developers to keep track of relationships between local and external resources efficiently.

Installation

Install the bundle using Composer:

composer require magicbart/external-reference-bundle

Then, enable the bundle in your Symfony application (if not done automatically):

// config/bundles.php
return [
    Magicbart\ExternalReferenceBundle\MagicbartExternalReferenceBundle::class => ['all' => true],,
];

Run the necessary database migrations if the bundle provides a storage mechanism:

php bin/console doctrine:migrations:migrate

Usage

Register an External Reference

use Magicbart\ExternalReferenceBundle\Manager\ExternalReferenceManager;

$referenceManager = $this->get(ExternalReferenceManager::class);
$referenceManager->add(User::class, $user->getId(), 'external_id', 'target');

Retrieve an External Reference

$externalReference = $referenceManager->get(User::class, $user->getId(), 'external_id', 'target');

Contributing

Feel free to contribute by submitting issues or pull requests to improve the bundle.

License

This bundle is licensed under the Apache License.