我想在另一个包"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)