Doctrine orm 条令不生成数据库架构多个关系
条令不会为多个关系生成数据库架构 c:\Bitnami\wampstack-5.6.30-0\apache2\htdocs\typejoy.biz>php供应商\doctor\orm\bin\doctor orm:schema工具:创建 为两个实体testChi和testPar创建两个表,但不创建@JoinTable“tParChiMTM” 实体测试池Doctrine orm 条令不生成数据库架构多个关系,doctrine-orm,console,Doctrine Orm,Console,条令不会为多个关系生成数据库架构 c:\Bitnami\wampstack-5.6.30-0\apache2\htdocs\typejoy.biz>php供应商\doctor\orm\bin\doctor orm:schema工具:创建 为两个实体testChi和testPar创建两个表,但不创建@JoinTable“tParChiMTM” 实体测试池 <?php namespace LogBundle\Entity; use Doctrine\Common\Collections\A
<?php
namespace LogBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
use Doctrine\ORM\Mapping\Index;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\JoinTable;
use Doctrine\ORM\Mapping\OneToOne;
use Doctrine\ORM\Mapping\OneToMany;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\ManyToMany;
use LogBundle\Entity\testPar;
/**
* @Table(name="ttestchi")
* @Entity()
*/
class testChi {
/**
* @var integer
*
* @Column(name="id", type="integer")
* @Id
* @GeneratedValue(strategy="AUTO")
*/
private $id;
/** @Column ( name="name", type="string", length=50, unique=false, nullable=true) */
private $name;
/** @ManyToMany ( targetEntity="testPar", mappedBy="chiMTM") */
private $parMTM;
public function __construct() {
$this->chiMTM = new ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Get name
*
* @return integer
*/
public function getName()
{
return $this->name;
}
/**
* Set name
* @param integer $name
* @return name
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
//make you have to serialize, deserialize entity here ???
/**
* Get parMTM
*
* @return LogBundle\Entity\ParMTM
*/
public function getParMTM()
{
return $this->parMTM;
}
/**
* Remove parMTM
*
* @param \LogBundle\Entity\testPar $parMTM
*/
public function removeParMTM (\LogBundle\Entity\testPar $parMTM)
{
if ( $this->hasParMTM($parMTM) ) {
$this->parMTM->removeElement($parMTM);
}
}
/**
* Add parMTM
*
* @param \LogBundle\Entity\testPar $parMTM
*
* @return ParMTM
*/
public function addParMTM(\LogBundle\Entity\testPar $parMTM)
{
if ( !$this->hasParMTM($parMTM) ) {
$this->parMTM[] = $parMTM;
}
return $this;
}
/**
* @param \LogBundle\Entity\testPar $parMTM
* @return bool
*/
public function hasParMTM($parMTM)
{
if( $this->getParMTM() ) {
return $this->getParMTM()->contains($parMTM);
}
}
/**
* Return Entity as string
*
* @return string String representation of this class
*/
public function __toString()
{
return strval($this->id);
}
}
原因在于注释:
对的
不能以/**
开始每一行,只有第一行包含此内容,后续行只能以单个*
开始
错:
<?php
namespace LogBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
use Doctrine\ORM\Mapping\Index;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\JoinTable;
use Doctrine\ORM\Mapping\OneToOne;
use Doctrine\ORM\Mapping\OneToMany;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\ManyToMany;
use LogBundle\Entity\testChi;
/**
* @Table(name="ttestpar")
* @Entity()
*/
class testPar {
/**
* @var integer
*
* @Column(name="id", type="integer")
* @Id
* @GeneratedValue(strategy="AUTO")
*/
private $id;
/** @Column ( name="name", type="string", length=50, unique=false, nullable=true) */
private $name;
/** @ManyToMany ( targetEntity="testChi", inversedBy="parMTM") */
/** @JoinTable ( name="tParChiMTM") */
private $chiMTM;
public function __construct() {
$this->chiMTM = new ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Get name
*
* @return integer
*/
public function getName()
{
return $this->name;
}
/**
* Set name
* @param integer $name
* @return name
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
//make you have to serialize, deserialize entity here ???
/**
* Get chiMTM
*
* @return LogBundle\Entity\ChiMTM
*/
public function getChiMTM()
{
return $this->chiMTM;
}
/**
* Remove chiMTM
*
* @param \LogBundle\Entity\testChi $chiMTM
*/
public function removeChiMTM (\LogBundle\Entity\testChi $chiMTM)
{
if ( $this->hasChiMTM($chiMTM) ) {
$this->chiMTM->removeElement($chiMTM);
}
}
/**
* Add chiMTM
*
* @param \LogBundle\Entity\testChi $chiMTM
*
* @return ChiMTM
*/
public function addChiMTM(\LogBundle\Entity\testChi $chiMTM)
{
if ( !$this->hasChiMTM($chiMTM) ) {
$this->chiMTM[] = $chiMTM;
}
return $this;
}
/**
* @param \LogBundle\Entity\testChi $chiMTM
* @return bool
*/
public function hasChiMTM($chiMTM)
{
if( $this->getChiMTM() ) {
return $this->getChiMTM()->contains($chiMTM);
}
}
/**
* Return Entity as string
*
* @return string String representation of this class
*/
public function __toString()
{
return strval($this->id);
}
}
/**
* @ManyToMany ( targetEntity="testPar", mappedBy="chiMTM") */
/**
* @ManyToMany ( targetEntity="testChi", inversedBy="parMTM")
* ( name="tParChiMTM") */
private $chiMTM;
/** @ManyToMany ( targetEntity="testChi", inversedBy="parMTM") */
/** @JoinTable ( name="tParChiMTM") */