{
  "id": "php/symfony-doctrine-mapping-duplicate-column",
  "signature": "Doctrine\\ORM\\Mapping\\MappingException: Duplicate column definition 'created_at' detected in entity 'App\\Entity\\Order'",
  "signature_zh": "Doctrine\\ORM\\Mapping\\MappingException：在实体 'App\\Entity\\Order' 中检测到重复的列定义 'created_at'",
  "regex": "/Duplicate column definition '[^']+' detected in entity '[^']+'/",
  "domain": "php",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "A Doctrine entity has two or more properties mapped to the same database column name, often due to inheritance mapping conflicts or copy-paste errors in annotations/attributes.",
  "root_cause_type": "generic",
  "root_cause_zh": "一个 Doctrine 实体有两个或多个属性映射到同一个数据库列名，通常是由于继承映射冲突或注解/属性中的复制粘贴错误。",
  "versions": [
    {
      "version": "Doctrine ORM 2.14",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Doctrine ORM 2.15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Doctrine ORM 3.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Clearing Doctrine metadata cache with `php bin/console doctrine:cache:clear-metadata`",
      "why_fails": "The error is in the mapping definition itself, not in a stale cache; clearing cache will not fix duplicate column definitions.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Removing all properties that reference 'created_at' from the entity",
      "why_fails": "This might remove needed functionality; the correct approach is to rename one of the properties or use a different column name.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Inspect the entity and its parent classes for duplicate column definitions. Run `php bin/console doctrine:mapping:info` to list all mapped fields. Then check each property's column attribute: e.g., `#[ORM\\Column(name: 'created_at')]` should appear only once. Rename one property's column to something else like 'created_at_utc'.",
      "success_rate": 0.9,
      "how": "Inspect the entity and its parent classes for duplicate column definitions. Run `php bin/console doctrine:mapping:info` to list all mapped fields. Then check each property's column attribute: e.g., `#[ORM\\Column(name: 'created_at')]` should appear only once. Rename one property's column to something else like 'created_at_utc'.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using inheritance (e.g., MappedSuperclass), ensure the child class does not override a column from the parent. Use `@ORM\\AttributeOverride` to explicitly rename columns in the child: `#[ORM\\AttributeOverrides([new ORM\\AttributeOverride(name: 'createdAt', column: new ORM\\Column(name: 'order_created_at'))])]`",
      "success_rate": 0.8,
      "how": "If using inheritance (e.g., MappedSuperclass), ensure the child class does not override a column from the parent. Use `@ORM\\AttributeOverride` to explicitly rename columns in the child: `#[ORM\\AttributeOverrides([new ORM\\AttributeOverride(name: 'createdAt', column: new ORM\\Column(name: 'order_created_at'))])]`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Inspect the entity and its parent classes for duplicate column definitions. Run `php bin/console doctrine:mapping:info` to list all mapped fields. Then check each property's column attribute: e.g., `#[ORM\\Column(name: 'created_at')]` should appear only once. Rename one property's column to something else like 'created_at_utc'.",
    "If using inheritance (e.g., MappedSuperclass), ensure the child class does not override a column from the parent. Use `@ORM\\AttributeOverride` to explicitly rename columns in the child: `#[ORM\\AttributeOverrides([new ORM\\AttributeOverride(name: 'createdAt', column: new ORM\\Column(name: 'order_created_at'))])]`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.doctrine-project.org/projects/doctrine-orm/en/2.14/reference/inheritance-mapping.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-05-02",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}