nalgoo / doctrine-custom-schema
Custom annotations for extending schema generation of Doctrine's SchemaTool
3.0.0
2023-05-04 08:37 UTC
Requires
- php: >=8.0
- doctrine/migrations: ~3.4
- doctrine/orm: ~2
Requires (Dev)
- ext-dom: *
- ext-json: *
- phpunit/phpunit: ~9.5
- roave/security-advisories: dev-latest
- symfony/cache: ~6.0
- webmozart/assert: ^1.11
README
This package allows you to define custom schema on top of your ORM model. For instance, creating foreign keys without the need of JoinColumn
.
Install via Composer
composer require nalgoo/doctrine-custom-schema
Usage
$entityManager = EntityManager::create(...);
CustomSchemaListener::register($entityManager);
Annotations
ForeignKey
class Entity
{
/**
* @ORM\Column(name="user_id", type="integer", nullable=false)
* @ForeignKey(refTable="user", refColumn="id", onUpdate="CASCADE", onDelete="CASCADE")
*/
public int $userId;
}