Property "*" in "*" was already declared, but it must be declared only once #6449

Open
opened 2026-01-22 15:33:28 +01:00 by admin · 4 comments
Owner

Originally created by @MyZik on GitHub (Apr 15, 2020).

Hello!

I'm trying to convert the SQL-file to Doctrine Entities. https://raw.githubusercontent.com/php-telegram-bot/core/master/structure.sql
As I know, I should to use command in console:

./vendor/bin/doctrine orm:convert-mapping php src/ --from-database --force

But I've got an error...

Property "chat" in "EditedMessage" was already declared, but it must be declared only once

How can I fix it?

Thank you a lot!

Originally created by @MyZik on GitHub (Apr 15, 2020). Hello! I'm trying to convert the SQL-file to Doctrine Entities. https://raw.githubusercontent.com/php-telegram-bot/core/master/structure.sql As I know, I should to use command in console: `./vendor/bin/doctrine orm:convert-mapping php src/ --from-database --force` But I've got an error... ``` Property "chat" in "EditedMessage" was already declared, but it must be declared only once ``` How can I fix it? Thank you a lot!
Author
Owner

@devnix commented on GitHub (Sep 7, 2020):

Suffering a similar bug here

@devnix commented on GitHub (Sep 7, 2020): Suffering a similar bug here
Author
Owner

@SenseException commented on GitHub (Sep 7, 2020):

Please evaluate your similar bug with the installed versions and an example of your code that will run into your problem.

@SenseException commented on GitHub (Sep 7, 2020): Please evaluate your similar bug with the installed versions and an example of your code that will run into your problem.
Author
Owner

@Jean85 commented on GitHub (Jun 25, 2024):

I'm encountering this exact bug while upgrading to ORM 3, from the latest patches in the 2.x series. DBAL was already on 3.

I think the trigger is in this chain:

abstract class BaseTimeblameableEntity
{
    /**
     * @var User|null
     */
    #[ORM\ManyToOne(targetEntity: User::class)]
    #[ORM\JoinColumn(name: 'created_by', nullable: false)]
    #[Gedmo\Blameable(on: 'create')]
    protected $createdBy;
// ...
}

#[ORM\Table(name: 'export_shutdown_bc')]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'discr', type: 'string', length: 20)]
#[ORM\DiscriminatorMap(['active' => 'ShutdownExportActive', 'passive' => 'ShutdownExportPassive'])]
#[ORM\Entity(repositoryClass: AbstractExportShutdownRepository::class)]
abstract class AbstractExportShutdown extends BaseTimeblameableEntity
{
// ...
}

#[ORM\Entity]
class ShutdownExportActive extends AbstractExportShutdown {}

I'll try to extract it and slim it down to verify my assumption.

@Jean85 commented on GitHub (Jun 25, 2024): I'm encountering this exact bug while upgrading to ORM 3, from the latest patches in the 2.x series. DBAL was already on 3. I think the trigger is in this chain: ```php abstract class BaseTimeblameableEntity { /** * @var User|null */ #[ORM\ManyToOne(targetEntity: User::class)] #[ORM\JoinColumn(name: 'created_by', nullable: false)] #[Gedmo\Blameable(on: 'create')] protected $createdBy; // ... } #[ORM\Table(name: 'export_shutdown_bc')] #[ORM\InheritanceType('SINGLE_TABLE')] #[ORM\DiscriminatorColumn(name: 'discr', type: 'string', length: 20)] #[ORM\DiscriminatorMap(['active' => 'ShutdownExportActive', 'passive' => 'ShutdownExportPassive'])] #[ORM\Entity(repositoryClass: AbstractExportShutdownRepository::class)] abstract class AbstractExportShutdown extends BaseTimeblameableEntity { // ... } #[ORM\Entity] class ShutdownExportActive extends AbstractExportShutdown {} ``` I'll try to extract it and slim it down to verify my assumption.
Author
Owner

@Jean85 commented on GitHub (Jun 25, 2024):

Reproduced in #11523, I should add that this doesn't happen if the relation is coming from a trait instead of an abstract class.

@Jean85 commented on GitHub (Jun 25, 2024): Reproduced in #11523, I should add that this doesn't happen if the relation is coming from a trait instead of an abstract class.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6449