symfony - Erreur in Installation PUGXMultiUserBundle -
i want install pugxmultiuserbundle. followed documentation of pugxmultiuserbundle:https://github.com/pugx/pugxmultiuserbundle/blob/master/resources/doc/index.md have downloaded pugxmultiuserbundle success , continued creating entities. created entity user:
<?php namespace register\userbundle\entity; use fos\userbundle\model\user baseuser; use doctrine\orm\mapping orm; use symfony\component\validator\constraints assert; /** * @orm\entity * @orm\table(name="user") * @orm\inheritancetype("joined") * @orm\discriminatorcolumn(name="type", type="string") * @orm\discriminatormap({"societe" = "societe", "chercheur" = "chercheur"}) * */ abstract class user extends baseuser { /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @var string $image * @orm\column(name="image", type="string", length=255) */ protected $image; public $file; protected function getuploaddir() { return 'image'; } protected function getuploadrootdir() { return __dir__.'/../../../../web/'.$this->getuploaddir()."/".$this->getid()."/"; } public function getwebpath() { return null === $this->image ? null : $this->getuploaddir().$this->getid()."/".'/'.$this->image; } public function getabsolutepath() { return null === $this->image ? null : $this->getuploadrootdir().$this->getid()."/".'/'.$this->image; } public function getabsolutepath1() { return null === $this->image ? null : $this->getuploadrootdir().$this->image; } /** * @orm\prepersist * @orm\preupdate */ public function preupload() { if (null !== $this->file) { // whatever want generate unique name $this->image = uniqid().'.'.$this->file->guessextension(); } } /** * @orm\postpersist * @orm\postupdate */ public function upload() { if (null === $this->file) { return; } // if there error when moving file, exception // automatically thrown move(). prevent // entity being persisted database on error $this->file->move($this->getuploadrootdir(), $this->image); unset($this->file); } /** * @orm\preremove() */ public function storefilenameforremove() { $this->filenameforremove = $this->getabsolutepath1(); } /** * @orm\postremove() */ public function removeupload() { if ($this->filenameforremove) { unlink($this->filenameforremove); } } }
and other entity: societe:
<?php namespace register\userbundle\entity; use doctrine\orm\mapping orm; use pugx\multiuserbundle\validator\constraints\uniqueentity; /** * @orm\entity * @orm\table(name="societe") * @uniqueentity(fields = "username", targetclass = "register\userbundle\entity\user", message="fos_user.username.already_used") * @uniqueentity(fields = "email", targetclass = "register\userbundle\entity\user", message="fos_user.email.already_used") */ class societe extends user { /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @var string $adressemail */ protected $adressemail; /** * @var string $namesociete */ protected $namesociete; }
an last entity chercheur:
<?php namespace register\userbundle\entity; use doctrine\orm\mapping orm; use pugx\multiuserbundle\validator\constraints\uniqueentity; use symfony\component\validator\constraints assert; /** * @orm\entity * @orm\haslifecyclecallbacks * @orm\table(name="chercheur") * @uniqueentity(fields = "username", targetclass = "register\userbundle\entity\user", message="fos_user.username.already_used") * @uniqueentity(fields = "email", targetclass = "register\userbundle\entity\user", message="fos_user.email.already_used") */ class chercheur extends user { /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @assert\notblank * @var string */ protected $region; /** * @assert\notblank * @var string */ protected $firstname; }
the problem when want generate entities after : php app/console doctrine:generate:entities register
, error message appeared in console:
[doctrine\orm\mapping\mappingexception] class "register" not valid entity or mapped super class. doctrine:generate:entities [--path="..."] [--no-backup] name .
can me fix problem , thank you.
Comments
Post a Comment