我有項目有不同的捆綁。我想創建或分割不同包中的實體,我如何創建它。我是symfony中的新人,請幫助我。我創建了,但我無法正確映射。一個具有主鍵的表不能在另一個捆綁中使用。symfony 2如何在不同的包中創建或映射實體
這裏是我的實體
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;
}
}
看http://symfony.com/doc/current/book/doctrine.html – websky 2015-02-23 15:41:19
我讀但它不適用於我 – 2015-02-23 15:52:18