php - Entity class has no field or association named like in my DB -
i want create request recovers number according e.rules_id, e.status_id
public function findstat() { $types = $this->em ->getrepository('ethanrestbundle:ethanrules') ->createquerybuilder('e') ->select('e.rules_id, e.status_id, count(*)') ->groupby('e.rules_id, e.status_id') ->orderby('rules_id'); $types = $types->getquery()->getsinglescalarresult(); homecoming $types; }
the error message:
[semantical error] line 0, col 9 near 'rules_id, e.status_id,': error: class ethan\restbundle\entity\ethanrules has no field or association named rules_id"
i develop on symfony 2 fosrestbundle create rest application
namespace ethan\restbundle\entity; utilize doctrine\orm\mapping orm; /** * ethanrules * * @orm\table(name="ethan_rules") * @orm\entity */ class ethanrules { /** * @var integer * * @orm\column(name="id", type="integer", nullable=false) * @orm\id * @orm\generatedvalue(strategy="identity") */ private $id; /** * @var string * * @orm\column(name="customer_key", type="string", length=45, nullable=false) */ private $customerkey; /** * @var string * * @orm\column(name="subscription_key", type="string", length=45, nullable=true) */ private $subscriptionkey; /** * @var string * * @orm\column(name="pole", type="string", length=45, nullable=false) */ private $pole; /** * @var string * * @orm\column(name="link_number", type="string", length=255, nullable=false) */ private $linknumber; /** * @var string * * @orm\column(name="user", type="string", length=100, nullable=true) */ private $user; /** * @var \datetime * * @orm\column(name="date_rdv", type="datetime", nullable=true) */ private $daterdv; /** * @var \datetime * * @orm\column(name="created_at", type="datetime", nullable=false) */ private $createdat; /** * @var \datetime * * @orm\column(name="updated_at", type="datetime", nullable=false) */ private $updatedat; /** * @var \rules * * @orm\manytoone(targetentity="rules") * @orm\joincolumns({ * @orm\joincolumn(name="rules_id", referencedcolumnname="id") * }) */ private $rules; /** * @var \status * * @orm\manytoone(targetentity="status") * @orm\joincolumns({ * @orm\joincolumn(name="status_id", referencedcolumnname="id") * }) */ private $status; public function _construct() { $this->createdat = new \datetime(); $this->createdat->settimestamp(time()); } /** * id * * @return integer */ public function getid() { homecoming $this->id; } /** * set customerkey * * @param string $customerkey * @return ethanrules */ public function setcustomerkey($customerkey) { $this->customerkey = $customerkey; homecoming $this; } /** * customerkey * * @return string */ public function getcustomerkey() { homecoming $this->customerkey; } /** * set subscriptionkey * * @param string $subscriptionkey * @return ethanrules */ public function setsubscriptionkey($subscriptionkey) { $this->subscriptionkey = $subscriptionkey; homecoming $this; } /** * subscriptionkey * * @return string */ public function getsubscriptionkey() { homecoming $this->subscriptionkey; } /** * set pole * * @param string $pole * @return ethanrules */ public function setpole($pole) { $this->pole = $pole; homecoming $this; } /** * pole * * @return string */ public function getpole() { homecoming $this->pole; } /** * set linknumber * * @param string $linknumber * @return ethanrules */ public function setlinknumber($linknumber) { $this->linknumber = $linknumber; homecoming $this; } /** * linknumber * * @return string */ public function getlinknumber() { homecoming $this->linknumber; } /** * set user * * @param string $user * @return ethanrules */ public function setuser($user) { $this->user = $user; homecoming $this; } /** * user * * @return string */ public function getuser() { homecoming $this->user; } /** * set daterdv * * @param \datetime $daterdv * @return ethanrules */ public function setdaterdv($daterdv) { $this->daterdv = $daterdv; homecoming $this; } /** * daterdv * * @return \datetime */ public function getdaterdv() { homecoming $this->daterdv; } /** * set createdat * * @param \datetime $createdat * @return ethanrules */ public function setcreatedat($createdat) { $this->createdat = $createdat; homecoming $this; } /** * createdat * * @return \datetime */ public function getcreatedat() { homecoming $this->createdat; } /** * set updatedat * * @param \datetime $updatedat * @return ethanrules */ public function setupdatedat($updatedat) { $this->updatedat = $updatedat; homecoming $this; } /** * updatedat * * @return \datetime */ public function getupdatedat() { homecoming $this->updatedat; } /** * set rules * * @param \ethan\restbundle\entity\rules $rules * @return ethanrules */ public function setrules(\ethan\restbundle\entity\rules $rules = null) { $this->rules = $rules; homecoming $this; } /** * rules * * @return \ethan\restbundle\entity\rules */ public function getrules() { homecoming $this->rules; } /** * set status * * @param \ethan\restbundle\entity\status $status * @return ethanrules */ public function setstatus(\ethan\restbundle\entity\status $status = null) { $this->status = $status; homecoming $this; } /** * status * * @return \ethan\restbundle\entity\status */ public function getstatus() { homecoming $this->status; } }
php symfony2 doctrine2
No comments:
Post a Comment