orm icon indicating copy to clipboard operation
orm copied to clipboard

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

Open MyZik opened this issue 5 years ago • 4 comments
trafficstars

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!

MyZik avatar Apr 15 '20 17:04 MyZik

Suffering a similar bug here

devnix avatar Sep 07 '20 11:09 devnix

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

SenseException avatar Sep 07 '20 18:09 SenseException

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 avatar Jun 25 '24 07:06 Jean85

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 avatar Jun 25 '24 12:06 Jean85