nalgoo / doctrine-custom-schema
为扩展Doctrine的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
此包允许您在ORM模型之上定义自定义架构。例如,创建外键而不需要JoinColumn
。
通过Composer安装
composer require nalgoo/doctrine-custom-schema
用法
$entityManager = EntityManager::create(...);
CustomSchemaListener::register($entityManager);
注解
外键
class Entity
{
/**
* @ORM\Column(name="user_id", type="integer", nullable=false)
* @ForeignKey(refTable="user", refColumn="id", onUpdate="CASCADE", onDelete="CASCADE")
*/
public int $userId;
}