DDC-2638: [GH-770] Fix for entity generator discriminator column #3308

Closed
opened 2026-01-22 14:17:47 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Aug 28, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @doctrinebot:

This issue is created automatically through a Github pull request on behalf of fulopattila122:

Url: https://github.com/doctrine/doctrine2/pull/770

Message:

I was using the EntityGenerator to create class files from yaml when I realized php warnings like PHP Warning: Illegal string offset 'name' on the console. Warnings have also been emitted for the type and length fields.

The generated php file also contained a wrong annotation for the discriminator column:

 * @ORM\DiscriminatorColumn(name="s", type="s", length=s)

The single change in this pull request resolves the problem, so even the warnings disappear and the generated file contains the proper annotation.

An example yaml:

Subscription:
  type: entity
  table: subscriptions
  id:
    id:
      type: integer
      generator:
        strategy: AUTO
  fields:
    created:
      type: datetime
    updated:
      type: datetime
  inheritanceType: SINGLE_TABLE
  discriminatorColumn:
    name: objectType
    type: string
    length: 255
  discriminatorMap:
  manyToOne:
    user:
      targetEntity: User
      joinColumn:
        name: user_id
        referencedColumnName: id
Originally created by @doctrinebot on GitHub (Aug 28, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @doctrinebot: This issue is created automatically through a Github pull request on behalf of fulopattila122: Url: https://github.com/doctrine/doctrine2/pull/770 Message: I was using the EntityGenerator to create class files from yaml when I realized php warnings like `PHP Warning: Illegal string offset 'name'` on the console. Warnings have also been emitted for the `type` and `length` fields. The generated php file also contained a wrong annotation for the discriminator column: ``` * @ORM\DiscriminatorColumn(name="s", type="s", length=s) ``` The single change in this pull request resolves the problem, so even the warnings disappear and the generated file contains the proper annotation. An example yaml: ``` Subscription: type: entity table: subscriptions id: id: type: integer generator: strategy: AUTO fields: created: type: datetime updated: type: datetime inheritanceType: SINGLE_TABLE discriminatorColumn: name: objectType type: string length: 255 discriminatorMap: manyToOne: user: targetEntity: User joinColumn: name: user_id referencedColumnName: id ```
admin added the Bug label 2026-01-22 14:17:47 +01:00
admin closed this issue 2026-01-22 14:17:48 +01:00
Author
Owner

@doctrinebot commented on GitHub (Aug 28, 2013):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-770] was closed:
https://github.com/doctrine/doctrine2/pull/770

@doctrinebot commented on GitHub (Aug 28, 2013): Comment created by @doctrinebot: A related Github Pull-Request [GH-770] was closed: https://github.com/doctrine/doctrine2/pull/770
Author
Owner

@doctrinebot commented on GitHub (Sep 7, 2013):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Sep 7, 2013): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3308