nalgoo / doctrine-custom-schema

为扩展Doctrine的SchemaTool的架构生成提供自定义注解

3.0.0 2023-05-04 08:37 UTC

This package is auto-updated.

Last update: 2024-09-04 11:39:54 UTC


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;
}