problems with many to many relationship
pi make many to many relationship b/w proposals and sections but when we
run proposals new form it gives the error like this:/p p[Semantical Error]
The annotation @ManyToMany in property
Proposals\ProposalsBundle\Entity\Proposals::$sections was never imported.
Did you maybe forget to add a use statement for this annotation? how to
remove this error? here is my code of proposals and sections entity:/p
precodelt;?php namespace Proposals\ProposalsBundle\Entity; use
Doctrine\ORM\Mapping as ORM; /** * Proposals */ class Proposals { // ...
/** * @ManyToMany(targetEntity=Sections, inversedBy=proposals) *
@JoinTable(name=ProposalSections) **/ private $sections; public function
__construct() { $this-gt;sections = new
\Doctrine\Common\Collections\ArrayCollection(); } // ... /** * @var
integer */ private $id; /** * @var string */ private $proposalName; /** *
@var string */ private $description; /** * @var integer */ private
$templateID; /** * @var integer */ private $clientID; /** * @var string */
private $status; /** * @var integer */ private $createdBy; /** * @var
integer */ private $updatedBy; /** * @var \DateTime */ private
$createdDatetime; /** * @var \DateTime */ private $updatedDatetime; /** *
Get id * * @return integer */ public function getId() { return
$this-gt;id; } /** * Set proposalName * * @param string $proposalName *
@return Proposals */ public function setProposalName($proposalName) {
$this-gt;proposalName = $proposalName; return $this; } /** * Get
proposalName * * @return string */ public function getProposalName() {
return $this-gt;proposalName; } /** * Set description * * @param string
$description * @return Proposals */ public function
setDescription($description) { $this-gt;description = $description; return
$this; } /** * Get description * * @return string */ public function
getDescription() { return $this-gt;description; } /** * Set templateID * *
@param integer $templateID * @return Proposals */ public function
setTemplateID($templateID) { $this-gt;templateID = $templateID; return
$this; } /** * Get templateID * * @return integer */ public function
getTemplateID() { return $this-gt;templateID; } /** * Set clientID * *
@param integer $clientID * @return Proposals */ public function
setClientID($clientID) { $this-gt;clientID = $clientID; return $this; }
/** * Get clientID * * @return integer */ public function getClientID() {
return $this-gt;clientID; } /** * Set status * * @param string $status *
@return Proposals */ public function setStatus($status) { $this-gt;status
= $status; return $this; } /** * Get status * * @return string */ public
function getStatus() { return $this-gt;status; } /** * Set createdBy * *
@param integer $createdBy * @return Proposals */ public function
setCreatedBy($createdBy) { $this-gt;createdBy = $createdBy; return $this;
} /** * Get createdBy * * @return integer */ public function
getCreatedBy() { return $this-gt;createdBy; } /** * Set updatedBy * *
@param integer $updatedBy * @return Proposals */ public function
setUpdatedBy($updatedBy) { $this-gt;updatedBy = $updatedBy; return $this;
} /** * Get updatedBy * * @return integer */ public function
getUpdatedBy() { return $this-gt;updatedBy; } /** * Set createdDatetime *
* @param \DateTime $createdDatetime * @return Proposals */ public function
setCreatedDatetime($createdDatetime) { $this-gt;createdDatetime =
$createdDatetime; return $this; } /** * Get createdDatetime * * @return
\DateTime */ public function getCreatedDatetime() { return
$this-gt;createdDatetime; } /** * Set updatedDatetime * * @param \DateTime
$updatedDatetime * @return Proposals */ public function
setUpdatedDatetime($updatedDatetime) { $this-gt;updatedDatetime =
$updatedDatetime; return $this; } /** * Get updatedDatetime * * @return
\DateTime */ public function getUpdatedDatetime() { return
$this-gt;updatedDatetime; } } /code/pre pand here is sections entity:/p
precodelt;?php namespace Proposals\ProposalsBundle\Entity; use
Doctrine\ORM\Mapping as ORM; /** * Sections */ class Sections { // ... /**
* @ManyToMany(targetEntity=Proposals, mappedBy=sections) **/ private
$proposals; public function __construct() { $this-gt;proposals = new
\Doctrine\Common\Collections\ArrayCollection(); } // ... /** * @var
integer */ private $id; /** * @var string */ private $sectionName; /** *
@var string */ private $description; /** * @var integer */ private
$createdBy; /** * @var integer */ private $updatedBy; /** * @var \DateTime
*/ private $createdDatetime; /** * @var \DateTime */ private
$updatedDatetime; /** * Get id * * @return integer */ public function
getId() { return $this-gt;id; } /** * Set sectionName * * @param string
$sectionName * @return Sections */ public function
setSectionName($sectionName) { $this-gt;sectionName = $sectionName; return
$this; } /** * Get sectionName * * @return string */ public function
getSectionName() { return $this-gt;sectionName; } /** * Set description *
* @param string $description * @return Sections */ public function
setDescription($description) { $this-gt;description = $description; return
$this; } /** * Get description * * @return string */ public function
getDescription() { return $this-gt;description; } /** * Set createdBy * *
@param integer $createdBy * @return Sections */ public function
setCreatedBy($createdBy) { $this-gt;createdBy = $createdBy; return $this;
} /** * Get createdBy * * @return integer */ public function
getCreatedBy() { return $this-gt;createdBy; } /** * Set updatedBy * *
@param integer $updatedBy * @return Sections */ public function
setUpdatedBy($updatedBy) { $this-gt;updatedBy = $updatedBy; return $this;
} /** * Get updatedBy * * @return integer */ public function
getUpdatedBy() { return $this-gt;updatedBy; } /** * Set createdDatetime *
* @param \DateTime $createdDatetime * @return Sections */ public function
setCreatedDatetime($createdDatetime) { $this-gt;createdDatetime =
$createdDatetime; return $this; } /** * Get createdDatetime * * @return
\DateTime */ public function getCreatedDatetime() { return
$this-gt;createdDatetime; } /** * Set updatedDatetime * * @param \DateTime
$updatedDatetime * @return Sections */ public function
setUpdatedDatetime($updatedDatetime) { $this-gt;updatedDatetime =
$updatedDatetime; return $this; } /** * Get updatedDatetime * * @return
\DateTime */ public function getUpdatedDatetime() { return
$this-gt;updatedDatetime; } } /code/pre
No comments:
Post a Comment