协会是指不存在的偏置侧面场



我有两个实体:

票务:

/**
 * @ORMMappedSuperclass()
 */
class Ticket implements TicketInterface
{
    const DIR_UPLOAD = 'TicketUpload';
    /**
     * @var integer
     *
     * @ORMColumn(name="id", type="integer")
     * @ORMId
     * @ORMGeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @ORMOneToMany(targetEntity="AppBundleEntityAttachment", mappedBy="ticket", cascade={"remove"}, orphanRemoval=true)
     */
    protected $attachments;
    /**
     * Ticket constructor.
     */
    public function __construct()
    {
        $this->attachments = new ArrayCollection();
    }
    public function getId(): ?int
    {
        return $this->id;
    }
    /**
     * Add attachments
     *
     * @param Attachment $attachments
     * @return Ticket
     */
    public function addAttachment(Attachment $attachments)
    {
        $this->attachments[] = $attachments;
        return $this;
    }
    /**
     * Remove attachments
     *
     * @param Attachment $attachments
     */
    public function removeAttachment(Attachment $attachments)
    {
        $this->attachments->removeElement($attachments);
    }
    /**
     * Get attachments
     *
     * @return Collection
     */
    public function getAttachments()
    {
        return $this->attachments;
    }
}

固定性:

/**
 * @ORMEntity(repositoryClass="AppBundleRepositoryAttachmentRepository")
 * @ORMTable(name="ticket_attachments")
 */
class Attachment
{
    const DIR_UPLOAD = 'TicketUpload';
    /**
     * @var int
     *
     * @ORMId
     * @ORMGeneratedValue
     * @ORMColumn(type="integer")
     */
    private $id;
    /**
     * @var string
     * @ORMColumn(type="text", nullable=true)
     */
    private $name;
    /**
     * @ORMManyToOne(targetEntity="AppBundleEntityTicket", inversedBy="attachments")
     * @ORMJoinColumn(name="ticket_id", referencedColumnName="id", nullable=true)
     */
    protected $ticket;
    /**
     * @AssertFile(
     *     maxSize = "300k",
     *     mimeTypes = {"application/pdf", "application/x-pdf", "text/plain", "application/msword",
     *     "application/vnd.ms-excel", "image/jpeg", "image/x-citrix-jpeg", "image/png", "image/x-citrix-png", "image/x-png", "image/gif"},
     *     mimeTypesMessage = "Liste de formats de fichiers acceptés : .pdf,.txt,.doc,.xls,.jpg,.png,.gif"
     * )
     */
    private $attachmentFile;
    /**
     * @ORMColumn(type="string", nullable=true)
     *
     */
    private $attachment;
    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }
    public function getName()
    {
        return $this->name;
    }

    public function setName($name): self
    {
        $this->name = $name;
        return $this;
    }
    public function getTicket(): ?Ticket
    {
        return $this->ticket;
    }
    public function setTicket(Ticket $ticket): void
    {
        $this->ticket = $ticket;
    }
    /**
     * @return mixed
     */
    public function getAttachment(): ?string
    {
        return $this->attachment;
    }
    public function setAttachment($attachment): self
    {
        $this->attachment = $attachment;
        return $this;
    }
    public function getAttachmentFile(): ?UploadedFile
    {
        return $this->attachmentFile;
    }
    /**
     * @param $attachmentFile
     * @return Ticket
     */
    public function setAttachmentFile($attachmentFile): self
    {
        $this->attachmentFile = $attachmentFile;
        return $this;
    }
    public function getAttachmentWebPath()
    {
        return self::DIR_UPLOAD . '/' . $this->getAttachment();
    }
}

我的目标是门票可以有几个附件。

我有一个错误:

协会AppBundle Entity 附件#票证是指 逆侧字段AppBundle Entity ticket#note 存在。

我不知道我在哪里...有人知道吗?

问候

映射的超类确实是不便的。真的。(强调我的(

映射的超类不能是一个实体,它不可查询,并且 由映射超类定义的持续关系必须是 单向(仅具有拥有的一侧(。这意味着一对一 > 此外,只有在映射的情况下才有可能 超级类仅在一个实体中仅用于一个实体。为了 进一步支持继承,单个或加入的表继承 必须使用功能。

因此,您不是技术上做错了什么,根本不支持它。产生的错误消息一点也不有用...

相关内容

  • 没有找到相关文章

最新更新