magicbart / external-reference-bundle
Add external reference between api and entity
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.3
- doctrine/doctrine-bundle: ^2.13
- doctrine/orm: ^3.3
- gedmo/doctrine-extensions: ^3.19
- symfony/config: ^6.4 | ^7.0
- symfony/console: ^6.4 | ^7.0
- symfony/dependency-injection: ^6.4 | ^7.0
- symfony/dotenv: ^6.4 | ^7.0
- symfony/flex: ^2
- symfony/framework-bundle: ^6.4 | ^7.0
- symfony/http-kernel: ^6.4 | ^7.0
- symfony/runtime: ^6.4 | ^7.0
- symfony/validator: ^6.4 | ^7.0
- symfony/yaml: ^6.4 | ^7.0
Requires (Dev)
- doctrine/doctrine-fixtures-bundle: *
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10
- phpstan/phpstan-doctrine: ^1.3
- phpstan/phpstan-symfony: ^1.3
- squizlabs/php_codesniffer: ^3.7
- symfony/browser-kit: ^6.4 | ^7.0
- symfony/http-client: ^6.4 | ^7.0
- symfony/phpunit-bridge: ^7.0
- symfony/web-profiler-bundle: ^6.4 | ^7.0
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.