Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MappingException line 420 after v3.5.3 update #12246

@davidnectarestudio

Description

@davidnectarestudio

Bug Report

Q A
Version 3.5.3

Summary

After v3.5.3 update I'm getting this error message:

Duplicate definition of column 'id' on entity 'App\Main\Domain\Model\AirCompany\AirCompanyAttachment' in a field or discriminator column mapping.

Current behavior

!!  In MappingException.php line 420:
!!                                                                                 
!!    Duplicate definition of column 'id' on entity 'App\Main\Domain\Model\AirCom  
!!    pany\AirCompanyAttachment' in a field or discriminator column mapping. 

After Symfony clear cache command.

Expected behavior

No exception thrown.

How to reproduce

namespace App\Main\Domain\Model\AirCompany;

use App\Main\Domain\Model\Attachment\AbstractAttachment;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;

#[ORM\Entity(repositoryClass: AirCompanyAttachmentRepository::class)]
#[Vich\Uploadable]
class AirCompanyAttachment extends AbstractAttachment
{
    #[Vich\UploadableField(mapping: 'air_company_attachments', fileNameProperty: 'vichFileName', size: 'size', mimeType: 'mimeType', originalName: 'path', dimensions: 'vichFileDimensions')]
    protected ?File $vichFile = null;
}
namespace App\Main\Domain\Model\Attachment;

use App\Shared\Domain\Model\AbstractBase;
use Doctrine\ORM\Mapping as ORM;
use Vich\UploaderBundle\Mapping\Annotation as Vich;

#[ORM\Entity(repositoryClass: AbstractAttachmentRepository::class)]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'type', type: 'string')]
#[ORM\DiscriminatorMap([
    'attachment' => Attachment::class,
    'air_company' => AirCompanyAttachment::class,
    'rate' => RateAttachment::class,
])]
#[ORM\Table(name: 'attachment')]
#[Vich\Uploadable]
abstract class AbstractAttachment extends AbstractBase
{
    #[ORM\Column(name: 'vich_file_name', type: Types::STRING, length: 255, nullable: true)]
    private ?string $vichFileName = null;
namespace App\Shared\Domain\Model;

use Doctrine\ORM\Mapping as ORM;

abstract class AbstractBase implements \Stringable
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column(type: Types::INTEGER)]
    protected ?int $id = null;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions