Php symfony 2如何在不同的捆绑包中创建或映射实体

Php symfony 2如何在不同的捆绑包中创建或映射实体,php,symfony,Php,Symfony,我有一个项目,它有不同的捆绑包。我想在不同的包中创建或分割实体,我如何创建它。我是新来的,请帮帮我。我已创建,但无法正确进行映射。具有主键的表不能在其他捆绑包中使用 这是我的实体 namespace DomainBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * WebsiteDomainConfigTest * * @ORM\Table(name="website_domain_config_test", indexes={@O

我有一个项目,它有不同的捆绑包。我想在不同的包中创建或分割实体,我如何创建它。我是新来的,请帮帮我。我已创建,但无法正确进行映射。具有主键的表不能在其他捆绑包中使用

这是我的实体

namespace DomainBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * WebsiteDomainConfigTest
 *
 * @ORM\Table(name="website_domain_config_test", indexes={@ORM\Index(name="fk_website_domain_config_test_1_idx", columns={"vendor_id"}), @ORM\Index(name="fk_website_domain_config_test_2_idx", columns={"country_id"})})
 * @ORM\Entity
 */
class WebsiteDomainConfigTest 
{
    /**
     * @var string
     *
     * @ORM\Column(name="domain", type="string", length=255, nullable=true)
     */
    private $domain;

    /**
     * @var string
     *
     * @ORM\Column(name="vendor_code", type="string", length=15, nullable=true)
     */
    private $vendorCode;

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

    /**
     * @var string
     *
     * @ORM\Column(name="assets_path", type="string", length=45, nullable=true)
     */
    private $assetsPath;

    /**
     * @var string
     *
     * @ORM\Column(name="language", type="string", length=3, nullable=true)
     */
    private $language;

    /**
     * @var string
     *
     * @ORM\Column(name="affiliate", type="string", length=25, nullable=true)
     */
    private $affiliate;

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

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

    /**
     * @var integer
     *
     * @ORM\Column(name="status", type="integer", nullable=true)
     */
    private $status;

    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var \MobileSplash\SplashRequestBundle\Entity\Countries
     *
     * @ORM\ManyToOne(targetEntity="MobileSplash\SplashRequestBundle\Entity\Countries")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="country_id", referencedColumnName="id")
     * })
     */
    private $country;

    /**
     * @var \MobileSplash\SplashRequestBundle\Entity\Vendors
     *
     * @ORM\ManyToOne(targetEntity="MobileSplash\SplashRequestBundle\Entity\Vendors")
     * @ORM\JoinColumns({
     * @ORM\JoinColumn(name="vendor_id", referencedColumnName="id")
     * })
     */
    private $vendor;



    /**
     * Set domain
     *
     * @param string $domain
     * @return WebsiteDomainConfigTest
     */
    public function setDomain($domain)
    {
        $this->domain = $domain;

        return $this;
    }

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

    /**
     * Set vendorCode
     *
     * @param string $vendorCode
     * @return WebsiteDomainConfigTest
     */
    public function setVendorCode($vendorCode)
    {
        $this->vendorCode = $vendorCode;

        return $this;
    }

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

    /**
     * Set domainPath
     *
     * @param string $domainPath
     * @return WebsiteDomainConfigTest
     */
    public function setDomainPath($domainPath)
    {
        $this->domainPath = $domainPath;

        return $this;
    }

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

    /**
     * Set assetsPath
     *
     * @param string $assetsPath
     * @return WebsiteDomainConfigTest
     */
    public function setAssetsPath($assetsPath)
    {
        $this->assetsPath = $assetsPath;

        return $this;
    }

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

    /**
     * Set language
     *
     * @param string $language
     * @return WebsiteDomainConfigTest
     */
    public function setLanguage($language)
    {
        $this->language = $language;

        return $this;
    }

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

    /**
     * Set affiliate
     *
     * @param string $affiliate
     * @return WebsiteDomainConfigTest
     */
    public function setAffiliate($affiliate)
    {
        $this->affiliate = $affiliate;

        return $this;
    }

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

    /**
     * Set affiliateLogo
     *
     * @param string $affiliateLogo
     * @return WebsiteDomainConfigTest
     */
    public function setAffiliateLogo($affiliateLogo)
    {
        $this->affiliateLogo = $affiliateLogo;

        return $this;
    }

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

    /**
     * Set affiliateAddress
     *
     * @param string $affiliateAddress
     * @return WebsiteDomainConfigTest
     */
    public function setAffiliateAddress($affiliateAddress)
    {
        $this->affiliateAddress = $affiliateAddress;

        return $this;
    }

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

    /**
     * Set status
     *
     * @param integer $status
     * @return WebsiteDomainConfigTest
     */
    public function setStatus($status)
    {
        $this->status = $status;

        return $this;
    }

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

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

    /**
     * Set country
     *
     * @param \MobileSplash\SplashRequestBundle\Entity\Countries $country
     * @return WebsiteDomainConfigTest
     */
    public function setCountry(\MobileSplash\SplashRequestBundle\Entity\Countries $country = null)
    {
        $this->country = $country;

        return $this;
    }

    /**
     * Get country
     *
     * @return \MobileSplash\SplashRequestBundle\Entity\Countries 
     */
    public function getCountry()
    {
        return $this->country;
    }

    /**
     * Set vendor
     *
     * @param \MobileSplash\SplashRequestBundle\Entity\Vendors $vendor
     * @return WebsiteDomainConfigTest
     */
    public function setVendor(\MobileSplash\SplashRequestBundle\Entity\Vendors $vendor = null)
    {
        $this->vendor = $vendor;

        return $this;
    }

    /**
     * Get vendor
     *
     * @return \MobileSplash\SplashRequestBundle\Entity\Vendors 
     */
    public function getVendor()
    {
        return $this->vendor;
    }
}

在注释中,使用如下名称空间:

targetEntity="\Mj\FooBundle\Entity\Foo"

看,我读过,但它不适用于我在“DomainBundle\entity\WebsiteDomainConfigTestcountry”中找不到目标实体DomainBundle\entity\Countries.@VikasShinde Hmmm在mobilespalsh之前添加\怎么样