dtpa98038 2015-10-11 20:53
浏览 60

学说 - 映射不起作用

I have problem with Doctrine mapping. First of all I'll introduce my two entites:

/**
* @ORM\Entity
* @ORM\Table(name="header_fotos")
*/

class HeaderFoto extends BaseEntity{

    ....    

    /**
     * 
     * @ORM\Column(type="integer") 
     * @ORM\ManyToOne(targetEntity="\App\Webpage\Webpage", inversedBy="headerFotos")
     * @ORM\JoinColumn(name="webpage_id", referencedColumnName="id")
     */
    protected $webpage;

    ...
}

Second entity:

/**
 * @ORM\Entity
 * @ORM\Table(name="webpages")
 */
class Webpage extends BaseEntity{
    ...

    /**
     * @ORM\OneToMany(targetEntity="\App\Webpage\HeaderFoto", mappedBy="webpage")
     */
    protected $headerFotos;

    public function __construct() {
        parent::__construct();

        $this->headerFotos = new ArrayCollection();
    }

My problem is with mapping. When I load entity Webpage and try to access all entities of type HeaderFoto it cannot find any relation. I was trying to compare with another working project with Doctrine and everything is the same.

I was trying to change association to OneToOne on the both sides, just for sure. But in this case it returned Exception No mapping found for field webpage.

I will appreciate every help and advice. Thanks for help.

EDIT

To be more specific, it has problem in class \Doctrine\ORM\Persisters\BasicEntityPersister.php in method getOneToManyStatement. It tries to load associated objects, but the array associationMappings in this class is empty. This is the last thing what I have found out.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 多址通信方式的抗噪声性能和系统容量对比
    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题
    • ¥15 finalshell节点的搭建代码和那个端口代码教程
    • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
    • ¥15 Centos / PETSc / PETGEM
    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 海浪数据 南海地区海况数据,波浪数据