小编aps*_*one的帖子

来自Symfony2.3中另一个包的"targetEntity"

我想在另一个包"targetEntity"属性中使用一个实体,但它生成错误...

在这堂课之间:

namespace Tgb\CoreBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * Website
 *
 * @ORM\Table(name="core_website")
 * @ORM\Entity(repositoryClass="Tgb\CoreBundle\Entity\WebsiteRepository")
 */
class Website
{

    /**
     * @var Tgb\BlogBunble\Entity\Blog
     *
     * @ORM\OneToOne(targetEntity="Tgb\BlogBunble\Entity\Blog", mappedBy="website")
     */
    private $blog;
Run Code Online (Sandbox Code Playgroud)

还有这个 :

namespace Tgb\BlogBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * Blog
 *
 * @ORM\Table(name="blog")
 * @ORM\Entity(repositoryClass="Tgb\BlogBundle\Entity\BlogRepository")
 */
class Blog
{

    /**
     * @var Tgb\CoreBunble\Entity\Website
     *
     * @ORM\OneToOne(targetEntity="Tgb\CoreBunble\Entity\Website", inversedBy="blog", cascade={"persist", "merge"})
     */
    private $website; …
Run Code Online (Sandbox Code Playgroud)

symfony doctrine-orm

5
推荐指数
1
解决办法
5957
查看次数

标签 统计

doctrine-orm ×1

symfony ×1