Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MyZik opened this issue Apr 15, 2020 · 4 comments
Open

Comments

@MyZik
Copy link

MyZik commented 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!

@devnix
Copy link

devnix commented Sep 7, 2020

Suffering a similar bug here

@SenseException
Copy link
Member

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

@Jean85
Copy link
Contributor

Jean85 commented 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 added a commit to Jean85/doctrine2 that referenced this issue Jun 25, 2024
@Jean85
Copy link
Contributor

Jean85 commented 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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants