Исключение сопоставления в Symfony / Doctrine: целевой объект App \ DocumentBundle \ File не найден в «App \ DocumentBundle \ Entity \ Document # file» - PullRequest
0 голосов
/ 03 февраля 2020

Я пытаюсь обновить приложение, работающее на Symfony 3.4, до версии 4.4. Я уже сделал несколько изменений и адаптаций в соответствии с официальной документацией для обновления Symfony. Тем не менее, я застрял сейчас со следующей ошибкой, которая появляется, когда я пытаюсь запустить команду в терминале или получить доступ к приложению через браузер.

Исключение отображения

Doctrine\ORM\Mapping\MappingException:
The target-entity App\DocumentBundle\File cannot be found in 'App\DocumentBundle\Entity\Document#file'.

  at /srv/http/sp7/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php:772
  at Doctrine\ORM\Mapping\MappingException::invalidTargetEntityClass('App\\DocumentBundle\\File', 'App\\DocumentBundle\\Entity\\Document', 'file')
     (/srv/http/sp7/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:1032)
  at Doctrine\ORM\Mapping\ClassMetadataInfo->validateAssociations()
     (/srv/http/sp7/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:266)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->validateRuntimeMetadata(object(ClassMetadata), object(ClassMetadata))
     (/srv/http/sp7/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:245)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata(object(ClassMetadata), object(ClassMetadata), false, array())
     (/srv/http/sp7/vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:306)
  at Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata('App\\DocumentBundle\\Entity\\Document')
     (/srv/http/sp7/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata('App\\DocumentBundle\\Entity\\Document')
     (/srv/http/sp7/vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:185)
  at Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('App\\DocumentBundle\\Entity\\Document')
     (/srv/http/sp7/vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:91)
  at Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata()
     (/srv/http/sp7/vendor/mgilet/notification-bundle/NotifiableDiscovery.php:76)
  at Mgilet\NotificationBundle\NotifiableDiscovery->discoverNotifiables()
     (/srv/http/sp7/vendor/mgilet/notification-bundle/NotifiableDiscovery.php:40)
  at Mgilet\NotificationBundle\NotifiableDiscovery->__construct(object(EntityManager), object(CachedReader))
     (/srv/http/sp7/var/cache/dev/ContainerSAZB8iG/srcApp_KernelDevDebugContainer.php:6135)
  at ContainerSAZB8iG\srcApp_KernelDevDebugContainer->getMgilet_NotificationService()
     (/srv/http/sp7/var/cache/dev/ContainerSAZB8iG/srcApp_KernelDevDebugContainer.php:7481)
  at ContainerSAZB8iG\srcApp_KernelDevDebugContainer->getTwigService()
     (/srv/http/sp7/var/cache/dev/ContainerSAZB8iG/srcApp_KernelDevDebugContainer.php:13406)
  at ContainerSAZB8iG\srcApp_KernelDevDebugContainer->getSensioFrameworkExtra_View_ListenerService()
     (/srv/http/sp7/var/cache/dev/ContainerSAZB8iG/srcApp_KernelDevDebugContainer.php:4501)
  at ContainerSAZB8iG\srcApp_KernelDevDebugContainer->ContainerSAZB8iG\{closure}()
     (/srv/http/sp7/vendor/symfony/event-dispatcher/EventDispatcher.php:301)
  at Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}(object(ControllerEvent), 'kernel.controller', object(EventDispatcher))
     (/srv/http/sp7/vendor/symfony/event-dispatcher/EventDispatcher.php:264)
  at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure)), 'kernel.controller', object(ControllerEvent))
     (/srv/http/sp7/vendor/symfony/event-dispatcher/EventDispatcher.php:239)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners(array(object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure)), 'kernel.controller', object(ControllerEvent))
     (/srv/http/sp7/vendor/symfony/event-dispatcher/EventDispatcher.php:73)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch(object(ControllerEvent), 'kernel.controller')
     (/srv/http/sp7/vendor/symfony/http-kernel/HttpKernel.php:134)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (/srv/http/sp7/vendor/symfony/http-kernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (/srv/http/sp7/vendor/symfony/http-kernel/Kernel.php:201)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (/srv/http/sp7/public/index.php:25)                

Сам код должен хранить документ и предлагать возможность прикреплять файлы к документам. Поэтому я использовал Vich / Uploader-Bundle и подозреваю, что ошибка как-то связана с Vich.

Document. php

<?php

namespace App\DocumentBundle\Entity;

use App\Entity\FileAwareEntity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Bundle\DoctrineBundle\Registry;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Security\Core\Security;
use App\UserBundle\Entity\User as User;
use Symfony\Component\Serializer\Annotation\Groups;


/**
 * @ORM\HasLifecycleCallbacks()
 * @ORM\Table(name="document_document", options={"engine"="InnoDB"})
 * @ORM\Entity(repositoryClass="App\DocumentBundle\Entity\DocumentRepository")
 */
class Document extends FileAwareEntity {
    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;


     /**
     * @Assert\NotBlank()
     * @var string
     * @ORM\Column(type="string")
     * @Groups({"elastica"})
     */
    private $name;


     /**
     *
     * @var string
     * @ORM\Column(type="text", nullable=true)
     * @Groups({"elastica"})
     */
    private $description;


    /**
    *
    * @var string
    * @ORM\Column(type="string", nullable=true)
    * @Groups({"elastica"})
    */
   private $headline;


    /**
    * @ORM\ManyToOne(targetEntity="App\DocumentBundle\Entity\DocumentType")
    * @ORM\JoinColumn(name="type", referencedColumnName="id")
    * @ORM\OrderBy({"translationKey" = "ASC"})
    * @var \App\DocumentBundle\Entity\DocumentType
    * @Groups({"elastica"})
    **/
    private $type;

     /**
     * @var string
     * @ORM\Column(type="string", nullable=true)
     * @Groups({"elastica"})
     */
    private $vkaNumber;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $linkedDocument;

    /**
     * @var string
     * @ORM\Column(type="string", nullable=true)
     */
    private $linkedDocumentExpires;


    /**
     * @var boolean
     * @ORM\Column(type="boolean", nullable=true)
     * @Groups({"elastica"})
     */
    private $active;

    /**
     * @var boolean
     * @ORM\Column(type="boolean", nullable=true)
      */
    private $status_stealth;

    /**
     * @var boolean
     * @ORM\Column(type="boolean", nullable=true)
     */
    private $locked;


    /**
     * $var DateTime
     * @ORM\Column(type="datetime", nullable=true)
     * @Groups({"elastica"})
     */
    private $created;

     //     * @Groups({"elastica"})
     /**
     * @ORM\ManyToOne(targetEntity="App\UserBundle\Entity\User", inversedBy="documentsCreated")
     * @ORM\JoinColumn(name="createdBy", referencedColumnName="id")
     * @var \App\UserBundle\Entity\User

     **/
    private $createdBy;

    /**
     * $var DateTime
     * @ORM\Column(type="datetime", nullable=true)
     * @Assert\Expression(
     *     "false == this.getStealthException()",
     *     message="The effective date must be in the future!")
     * @Groups({"elastica"})
     */
    private $effective;

    /**
     * $var DateTime
     * @ORM\Column(type="datetime", nullable=true)
     * @Assert\Expression(
     *     "this.getEffective() < this.getExpires()",
     *     message="The expiration date can't be before the effective date")
     */
    private $expires;

    /**
     * $var DateTime
     * @ORM\Column(type="datetime", nullable=true)
     */
    private $modified;

    /**
     * @ORM\ManyToOne(targetEntity="App\UserBundle\Entity\User")
     * @ORM\JoinColumn(name="modifiedBy", referencedColumnName="id")
     * @var \App\UserBundle\Entity\User
     **/
    private $modifiedBy;

    //     * @Groups({"elastica"})
    /**
     * @ORM\ManyToMany(targetEntity="App\Entity\Agency", inversedBy="documentagency", cascade={"persist"})
     * @ORM\JoinTable(name="document_document_agency",
     *   joinColumns={@ORM\JoinColumn(name="document_id", referencedColumnName="id")},
     *   inverseJoinColumns={@ORM\JoinColumn(name="iata8", referencedColumnName="iata8")})
     * @var \App\Entity\Agency

     **/
    private $agency;

    /**
     * $var boolean
     * @ORM\Column(type="boolean", nullable=true)
     */
    private $signature;

    /**
     * $var boolean
     * @ORM\Column(type="boolean", nullable=true)
     */
    private $signed;

    /**
    * @ORM\ManyToOne(targetEntity="App\UserBundle\Entity\User", inversedBy="documentSigned")
    * @ORM\JoinColumn(name="signedBy", referencedColumnName="id")
    * @var \App\UserBundle\Entity\User
    **/
    private $signedBy;

    /**
     * @ORM\OneToMany(targetEntity="App\DocumentBundle\Entity\Comment", mappedBy="document",cascade={"remove"})
     * @var \Doctrine\Common\Collections\Collection
     **/
    protected $comment;

    //     * @Groups({"elastica"})
    /**
     * @ORM\ManyToMany(targetEntity="App\Entity\Market", inversedBy="document", cascade={"persist"})
     * @ORM\JoinTable(name="document_document_market",
     *   joinColumns={@ORM\JoinColumn(name="document_id", referencedColumnName="id")},
     *   inverseJoinColumns={@ORM\JoinColumn(name="market_id", referencedColumnName="id")})
     * @Assert\Count(
     *      min = "0"
     * )

     **/
    private $market;

    //     * @Groups({"elastica"})
    /**
     * @ORM\ManyToMany(targetEntity="App\Entity\Airline", inversedBy="document", cascade={"persist"})
     * @ORM\JoinTable(name="document_document_airline",
     *   joinColumns={@ORM\JoinColumn(name="document_id", referencedColumnName="id")},
     *   inverseJoinColumns={@ORM\JoinColumn(name="airline_id", referencedColumnName="id")})
     * @Assert\Count(
     *      min = "0"
     * )
     * @var \App\Entity\Airline

     **/
    private $airline;

    //     * @Groups({"elastica"})
    /**
     * @ORM\ManyToMany(targetEntity="App\Entity\Product", inversedBy="document", cascade={"persist"})
     * @ORM\JoinTable(name="document_document_product",
     *   joinColumns={@ORM\JoinColumn(name="document_id", referencedColumnName="id")},
     *   inverseJoinColumns={@ORM\JoinColumn(name="product_id", referencedColumnName="id")})
     * @Assert\Count(
     *      min = "0"
     * )
     * @var \App\Entity\Product

     **/
    private $product;

    //     * @Groups({"elastica"})
    /**
     * @ORM\ManyToMany(targetEntity="App\ReferentialBundle\Entity\Channel1", inversedBy="document", cascade={"persist"})
     * @ORM\JoinTable(name="document_document_channel",
     *   joinColumns={@ORM\JoinColumn(name="document_id", referencedColumnName="id")},
     *   inverseJoinColumns={@ORM\JoinColumn(name="channel_id", referencedColumnName="id")})
     * @Assert\Count(
     *      min = "0"
     * )
     * @var \App\ReferentialBundle\Entity\Channel1

     **/

    private $channel;
    /**
     * $var boolean
     * @ORM\Column(type="boolean", nullable=true)
     */
    private $internalCom;

    /**
     * @ORM\OneToMany(targetEntity="App\DocumentBundle\File", mappedBy="entity", cascade={"persist", "merge", "remove"}, orphanRemoval=true)
     * @Assert\Valid()
     * @var \Doctrine\Common\Collections\Collection
     **/
    protected $file;

    /**
    * @ORM\ManyToOne(targetEntity="App\DocumentBundle\Entity\Status")
    * @ORM\JoinColumn(name="status", referencedColumnName="id", nullable=false)
    * @var \App\DocumentBundle\Entity\Status
    *      @Groups({"elastica"})
    */
    private $status;

    /**
     * @ORM\ManyToMany(targetEntity="App\DocumentBundle\Entity\UploadProfile", inversedBy="documents", cascade={"persist"})
     * @ORM\JoinTable(name="document_document_uploadprofile",
     *   joinColumns={@ORM\JoinColumn(name="document_id", referencedColumnName="id")},
     *   inverseJoinColumns={@ORM\JoinColumn(name="uploadprofile_id", referencedColumnName="id")})
     * @var \App\DocumentBundle\Entity\UploadProfile
     **/
    protected $uploadprofile;

    /**
     * @ORM\Column(type="decimal", precision=7, scale=7, nullable = true)
     */
    protected $esScore;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->locked = false;
        $this->signed = false;
        $this->market = new \Doctrine\Common\Collections\ArrayCollection();
        $this->agency = new \Doctrine\Common\Collections\ArrayCollection();
        $this->channel = new \Doctrine\Common\Collections\ArrayCollection();
        $this->product = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /* Entity: Functions ************************************************************************/


    public function getCurrentDate(){
      return new \DateTime();
      }

    /**
     * @ORM\PrePersist
     */
    public function prePersist() {

        date_default_timezone_set('Europe/Berlin');

        if($this->created == null)
        {
            $this->created = new \DateTime("now");
        }
        $market = $this->getMarket();
        if(count($this->getAgency()) > 0){
          foreach($this->getAgency() as $agency) {
            if(!$this->market->contains($agency->getMarket())) {
              $this->addMarket($agency->getMarket());
            }
          }
        }
    }

    /**
     * @ORM\PreUpdate
     */
    public function preUpdate() {

        date_default_timezone_set('Europe/Berlin');

        if($this->modified == null)
        {
            $this->modified = new \DateTime("now");
        }

        $market = $this->getMarket();
        if(count($this->getAgency()) > 0){
          foreach($this->getAgency() as $agency) {
            if(!$this->market->contains($agency->getMarket())) {
              $this->addMarket($agency->getMarket());
            }
          }
        }
    }

    /**
     * Get statusStealth
     *
     * @return boolean
     */
    public function getStatusStealth()
    {
        return $this->status_stealth;
    }
    public function getStealthException(){
      if ($this->getEffective() < $this->getCurrentDate() && $this->getStatusStealth() == true){
        return true;
      } else{
      return false;
    }
  }

  public function show()
  {

    return array(
      "domain" => "document",
      "id" => $this->id,
      "info" => $this->getHeadline(),
      "title" => $this->name . ' - ' . $this->vkaNumber,
      "airlines" => $this->getAirline(),
      "agencies" => $this->getAgency(),
      "markets" => $this->getMarket(),
      "vkaNumber" => $this->vkaNumber,
      "path" => "documentBundle_view_document",
      "pathVariable" => "id",
      "pathValue" => $this->id,
      "bootstrapColor" => 'primary',
    );
  }


  /* Entity: Functions ************************************************************************/



    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     *
     * @return Document
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set description
     *
     * @param string $description
     *
     * @return Document
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    /**
     * Get description
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Set headline
     *
     * @param string $headline
     *
     * @return Document
     */
    public function setHeadline($headline)
    {
        $this->headline = $headline;

        return $this;
    }

    /**
     * Get headline
     *
     * @return string
     */
    public function getHeadline()
    {
        return $this->headline;
    }

    /**
     * Set vkaNumber
     *
     * @param string $vkaNumber
     *
     * @return Document
     */
    public function setVkaNumber($vkaNumber)
    {
        $this->vkaNumber = $vkaNumber;

        return $this;
    }

    /**
     * Get vkaNumber
     *
     * @return string
     */
    public function getVkaNumber()
    {
        return $this->vkaNumber;
    }

    /**
     * Set linkedDocument
     *
     * @param string $linkedDocument
     *
     * @return Document
     */
    public function setLinkedDocument($linkedDocument)
    {
        $this->linkedDocument = $linkedDocument;

        return $this;
    }

    /**
     * Get linkedDocument
     *
     * @return string
     */
    public function getLinkedDocument()
    {
        return $this->linkedDocument;
    }

    /**
     * Set linkedDocumentExpires
     *
     * @param string $linkedDocumentExpires
     *
     * @return Document
     */
    public function setLinkedDocumentExpires($linkedDocumentExpires)
    {
        $this->linkedDocumentExpires = $linkedDocumentExpires;

        return $this;
    }

    /**
     * Get linkedDocumentExpires
     *
     * @return string
     */
    public function getLinkedDocumentExpires()
    {
        return $this->linkedDocumentExpires;
    }

    /**
     * Set active
     *
     * @param boolean $active
     *
     * @return Document
     */
    public function setActive($active)
    {
        $this->active = $active;

        return $this;
    }

    /**
     * Get active
     *
     * @return boolean
     */
    public function getActive()
    {
        return $this->active;
    }

    /**
     * Set statusStealth
     *
     * @param boolean $statusStealth
     *
     * @return Document
     */
    public function setStatusStealth($statusStealth)
    {
        $this->status_stealth = $statusStealth;

        return $this;
    }

    /**
     * Set locked
     *
     * @param boolean $locked
     *
     * @return Document
     */
    public function setLocked($locked)
    {
        $this->locked = $locked;

        return $this;
    }

    /**
     * Get locked
     *
     * @return boolean
     */
    public function getLocked()
    {
        return $this->locked;
    }

    /**
     * Set created
     *
     * @param \DateTime $created
     *
     * @return Document
     */
    public function setCreated($created)
    {
        $this->created = $created;

        return $this;
    }

    /**
     * Get created
     *
     * @return \DateTime
     */
    public function getCreated()
    {
        return $this->created;
    }

    /**
     * Set effective
     *
     * @param \DateTime $effective
     *
     * @return Document
     */
    public function setEffective($effective)
    {
        $this->effective = $effective;

        return $this;
    }

    /**
     * Get effective
     *
     * @return \DateTime
     */
    public function getEffective()
    {
        return $this->effective;
    }

    /**
     * Set expires
     *
     * @param \DateTime $expires
     *
     * @return Document
     */
    public function setExpires($expires)
    {
        $this->expires = $expires;

        return $this;
    }

    /**
     * Get expires
     *
     * @return \DateTime
     */
    public function getExpires()
    {
        return $this->expires;
    }

    /**
     * Set modified
     *
     * @param \DateTime $modified
     *
     * @return Document
     */
    public function setModified($modified)
    {
        $this->modified = $modified;

        return $this;
    }

    /**
     * Get modified
     *
     * @return \DateTime
     */
    public function getModified()
    {
        return $this->modified;
    }

    /**
     * Set signature
     *
     * @param boolean $signature
     *
     * @return Document
     */
    public function setSignature($signature)
    {
        $this->signature = $signature;

        return $this;
    }

    /**
     * Get signature
     *
     * @return boolean
     */
    public function getSignature()
    {
        return $this->signature;
    }

    /**
     * Set signed
     *
     * @param boolean $signed
     *
     * @return Document
     */
    public function setSigned($signed)
    {
        $this->signed = $signed;

        return $this;
    }

    /**
     * Get signed
     *
     * @return boolean
     */
    public function getSigned()
    {
        return $this->signed;
    }

    /**
     * Set internalCom
     *
     * @param boolean $internalCom
     *
     * @return Document
     */
    public function setInternalCom($internalCom)
    {
        $this->internalCom = $internalCom;

        return $this;
    }

    /**
     * Get internalCom
     *
     * @return boolean
     */
    public function getInternalCom()
    {
        return $this->internalCom;
    }

    /**
     * Set esScore
     *
     * @param string $esScore
     *
     * @return Document
     */
    public function setEsScore($esScore)
    {
        $this->esScore = $esScore;

        return $this;
    }

    /**
     * Get esScore
     *
     * @return string
     */
    public function getEsScore()
    {
        return $this->esScore;
    }

    /**
     * Set type
     *
     * @param \App\DocumentBundle\Entity\DocumentType $type
     *
     * @return Document
     */
    public function setType(\App\DocumentBundle\Entity\DocumentType $type = null)
    {
        $this->type = $type;

        return $this;
    }

    /**
     * Get type
     *
     * @return \App\DocumentBundle\Entity\DocumentType
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * Set createdBy
     *
     * @param \App\UserBundle\Entity\User $createdBy
     *
     * @return Document
     */
    public function setCreatedBy(\App\UserBundle\Entity\User $createdBy = null)
    {
        $this->createdBy = $createdBy;

        return $this;
    }

    /**
     * Get createdBy
     *
     * @return \App\UserBundle\Entity\User
     */
    public function getCreatedBy()
    {
        return $this->createdBy;
    }

    /**
     * Set modifiedBy
     *
     * @param \App\UserBundle\Entity\User $modifiedBy
     *
     * @return Document
     */
    public function setModifiedBy(\App\UserBundle\Entity\User $modifiedBy = null)
    {
        $this->modifiedBy = $modifiedBy;

        return $this;
    }

    /**
     * Get modifiedBy
     *
     * @return \App\UserBundle\Entity\User
     */
    public function getModifiedBy()
    {
        return $this->modifiedBy;
    }

    /**
     * Add agency
     *
     * @param \App\Entity\Agency $agency
     *
     * @return Document
     */
    public function addAgency(\App\Entity\Agency $agency)
    {
        $this->agency[] = $agency;

        return $this;
    }

    /**
     * Remove agency
     *
     * @param \App\Entity\Agency $agency
     */
    public function removeAgency(\App\Entity\Agency $agency)
    {
        $this->agency->removeElement($agency);
    }

    /**
     * Get agency
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAgency()
    {
        return $this->agency;
    }

    /**
     * Set signedBy
     *
     * @param \App\UserBundle\Entity\User $signedBy
     *
     * @return Document
     */
    public function setSignedBy(\App\UserBundle\Entity\User $signedBy = null)
    {
        $this->signedBy = $signedBy;

        return $this;
    }

    /**
     * Get signedBy
     *
     * @return \App\UserBundle\Entity\User
     */
    public function getSignedBy()
    {
        return $this->signedBy;
    }

    /**
     * Add comment
     *
     * @param \App\DocumentBundle\Entity\Comment $comment
     *
     * @return Document
     */
    public function addComment(\App\DocumentBundle\Entity\Comment $comment)
    {
        $this->comment[] = $comment;

        return $this;
    }

    /**
     * Remove comment
     *
     * @param \App\DocumentBundle\Entity\Comment $comment
     */
    public function removeComment(\App\DocumentBundle\Entity\Comment $comment)
    {
        $this->comment->removeElement($comment);
    }

    /**
     * Get comment
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getComment()
    {
        return $this->comment;
    }

    /**
     * Add market
     *
     * @param \App\Entity\Market $market
     *
     * @return Document
     */
    public function addMarket(\App\Entity\Market $market)
    {
        $this->market[] = $market;

        return $this;
    }

    /**
     * Remove market
     *
     * @param \App\Entity\Market $market
     */
    public function removeMarket(\App\Entity\Market $market)
    {
        $this->market->removeElement($market);
    }

    /**
     * Get market
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getMarket()
    {
        return $this->market;
    }

    /**
     * Add airline
     *
     * @param \App\Entity\Airline $airline
     *
     * @return Document
     */
    public function addAirline(\App\Entity\Airline $airline)
    {
        $this->airline[] = $airline;

        return $this;
    }

    /**
     * Remove airline
     *
     * @param \App\Entity\Airline $airline
     */
    public function removeAirline(\App\Entity\Airline $airline)
    {
        $this->airline->removeElement($airline);
    }

    /**
     * Get airline
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAirline()
    {
        return $this->airline;
    }

    /**
     * Add product
     *
     * @param \App\Entity\Product $product
     *
     * @return Document
     */
    public function addProduct(\App\Entity\Product $product)
    {
        $this->product[] = $product;

        return $this;
    }

    /**
     * Remove product
     *
     * @param \App\Entity\Product $product
     */
    public function removeProduct(\App\Entity\Product $product)
    {
        $this->product->removeElement($product);
    }

    /**
     * Get product
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getProduct()
    {
        return $this->product;
    }

    /**
     * Add channel
     *
     * @param \App\ReferentialBundle\Entity\Channel1 $channel
     *
     * @return Document
     */
    public function addChannel(\App\ReferentialBundle\Entity\Channel1 $channel)
    {
        $this->channel[] = $channel;

        return $this;
    }

    /**
     * Remove channel
     *
     * @param \App\ReferentialBundle\Entity\Channel1 $channel
     */
    public function removeChannel(\App\ReferentialBundle\Entity\Channel1 $channel)
    {
        $this->channel->removeElement($channel);
    }

    /**
     * Get channel
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getChannel()
    {
        return $this->channel;
    }

    /**
     * Get file
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getFile()
    {
        return $this->file;
    }
}

File. php (дочерний класс)

<?php

namespace App\DocumentBundle;

use Doctrine\ORM\Mapping as ORM;
use App\Entity\File as BaseFile;

/**
 * This class extends the base file class. Only the mapped entity and table name are different.
 *
 * @ORM\HasLifecycleCallbacks()
 * @ORM\Table(name="document_file")
 * @ORM\Entity
 */
class File extends BaseFile {
    /**
     * @ORM\ManyToOne(targetEntity="App\DocumentBundle\Entity\Document", inversedBy="file")
     * @ORM\JoinColumn(name="entity", referencedColumnName="id", nullable=true)
     * @var \App\DocumentBundle\Entity\Document
     */
    protected $entity;
}

Я уже пытался очистить кеш, перезапустить сервер, обновить doctrine или прокомментировать свойство, но пока ничего не получалось. Кто-нибудь знает, как решить эту проблему?

...