Symfony integration for the Articulate context-bounded ORM.
composer require denisyu-1/articulate-symfony
If Symfony Flex does not enable the bundle automatically, add it manually:
// config/bundles.php
return [
Articulate\Symfony\ArticulateSymfonyBundle::class => ['all' => true],
];
# config/packages/articulate.yaml
articulate:
connection:
dsn: '%env(resolve:DATABASE_URL)%'
user: ''
password: ''
persistent: false
paths:
entities: '%kernel.project_dir%/src/Entity'
migrations: '%kernel.project_dir%/migrations/Articulate'
migrations_namespace: 'App\Migrations\Articulate'
cache:
result: cache.app
statement: cache.system
second_level: cache.app
second_level_ttl: 3600
logging:
enabled: '%kernel.debug%'
Inject the Articulate entity manager into your services:
use Articulate\Modules\EntityManager\EntityManager;
final class RegisterBook
{
public function __construct(private readonly EntityManager $entityManager)
{
}
public function __invoke(Book $book): void
{
$this->entityManager->persist($book);
$this->entityManager->flush();
}
}
The bundle also exposes Articulate\Connection for lower-level database work.
bin/console articulate:init
bin/console articulate:validate
bin/console articulate:diff
bin/console articulate:migrate
bin/console articulate:migrate --rollback
The command paths come from articulate.paths.entities and articulate.paths.migrations.
Repository classes declared through Articulate's #[Entity(repositoryClass: ...)] attribute are created automatically. To let Symfony build a repository service, tag it:
services:
App\Repository\BookRepository:
tags: ['articulate.repository']
Tagged repositories must implement Articulate\Modules\Repository\RepositoryInterface. Repositories extending Articulate's AbstractRepository continue to work without being registered as services.
How can I help you explore Laravel packages today?