Installation:
composer require common-gateway/zgw-zds-bundle:dev-main
For Dockerized environments:
docker-compose exec php composer require common-gateway/zgw-zds-bundle:dev-main
Install Schemas as Entities:
php bin/console commongateway:install common-gateway/zgw-zds-bundle
Or in Docker:
docker-compose exec php bin/console commongateway:install common-gateway/zgw-zds-bundle
Verify Installation:
Check if the bundle is registered in config/bundles.php and if the ZGWZdsBundle namespace is autoloaded.
Use this bundle as a template to scaffold a new Symfony Flex bundle for CommonGateway projects. It provides a minimal structure for:
commongateway:install command).Template Usage:
ZGWZdsBundle with your bundle’s namespace (e.g., MyCompanyMyBundle).Directory Structure:
src/
├── DependencyInjection/ # Configuration (Extension.php, MyCompanyMyExtension.php)
├── Entity/ # Doctrine entities (e.g., MyEntity.php)
├── Resources/config/ # Doctrine ORM/YAML/XML mappings
├── Resources/public/ # Static assets
└── MyCompanyMyBundle.php # Bundle class
Configuration:
CommonGatewayBundle in your MyCompanyMyBundle.php:
class MyCompanyMyBundle extends Bundle implements CommonGatewayBundleInterface
{
public function getPath(): string
{
return \dirname(__DIR__);
}
}
DependencyInjection/MyCompanyMyExtension.php:
public function load(array $configs, ContainerBuilder $container)
{
$container->loadFromExtension('doctrine', [
'orm' => [
'mappings' => [
'MyCompany' => __DIR__.'/../../Entity',
],
],
]);
}
Command Integration:
commongateway:install command to include your entities:
php bin/console make:command MyInstallCommand
Then register it in DependencyInjection/MyCompanyMyExtension.php:
$container->setDefinition('my.installer', new Definition(MyInstaller::class));
Admin UI Integration (TBD):
# config/packages/common_gateway.yaml
commongateway:
resources:
- MyCompany\MyBundle\Entity\MyEntity
php bin/console make:migration
php bin/console doctrine:migrations:migrate
php bin/console make:test
Dockerfile includes:
RUN composer require common-gateway/zgw-zds-bundle:dev-main
Missing Admin UI Docs:
@todo! for admin UI installation. Check the CommonGateway documentation for updates or ask in their Slack/Discord.Dev Dependency:
:dev-main, which may introduce instability. Pin to a stable release if available:
composer require common-gateway/zgw-zds-bundle:^1.0
Entity Overrides:
ZdsEntity), conflicts may arise. Prefix with your bundle name (e.g., MyBundleZdsEntity).Command Namespace Collisions:
MyInstallCommand) don’t clash with existing ones. Use unique namespaces:
namespace MyCompany\MyBundle\Command;
php bin/console debug:container MyCompanyMyBundle to verify the bundle is loaded.php bin/console doctrine:schema:validate
composer dump-autoload
composer.json has:
"extra": {
"symfony": {
"allow-contrib": true
}
}
commongateway:install command may require environment variables (e.g., DATABASE_URL). Set them in .env:
DATABASE_URL="mysql://user:pass@127.0.0.1:3306/db_name"
Custom Installer:
Extend the commongateway:install command by creating a custom installer class:
use CommonGateway\Installer\InstallerInterface;
class MyCustomInstaller implements InstallerInterface
{
public function install(): void
{
// Add your logic (e.g., load fixtures)
}
}
Register it in your extension:
$container->setAlias('my.installer', MyCustomInstaller::class);
Event Subscribers:
Listen to CommonGateway events (e.g., CommonGatewayEvents::POST_INSTALL) to run post-install logic:
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class MySubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return [
'common_gateway.post_install' => 'onPostInstall',
];
}
public function onPostInstall()
{
// Your logic
}
}
API Integration: If your bundle interacts with APIs, use Symfony’s HTTP client:
use Symfony\Contracts\HttpClient\HttpClientInterface;
class MyApiService
{
public function __construct(private HttpClientInterface $client) {}
public function fetchData(): array
{
return $this->client->request('GET', 'https://api.example.com/data')->toArray();
}
}
Register the service in your extension:
$container->setService('my.api_service', MyApiService::class);
How can I help you explore Laravel packages today?