mysql - doctrine:schema:update not updating y database -
some how whatever changes make in entites,doctrine doesn't seem update it.i know there similar questions.i have gone through them , tried :
php app/console cache:clear php app/console doctrine:cache:clear-metadata
php app/console doctrine:schema:update --force
i have never imported database,so there no orm.yaml files in src folder.
i using mysql database symfony , doctrine orm.
here config
doctrine: dbal: driver: pdo_mysql host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: utf8 # if using pdo_sqlite database driver: # 1. add path in parameters.yml # e.g. database_path: "%kernel.root_dir%/data/data.db3" # 2. uncomment database_path in parameters.yml.dist # 3. uncomment next line: # path: "%database_path%" orm: auto_generate_proxy_classes: "%kernel.debug%" naming_strategy: doctrine.orm.naming_strategy.underscore auto_mapping: true
doctrine:schema:validate gives me this:
[mapping] fail - entity-class 'madhuri\termsbundle\entity\relatedterm' mapping invalid: * association madhuri\termsbundle\entity\relatedterm#term1 refers inverse side field madhuri\termsbundle\entity\term#relatedterm not exist.
my entities term.php
namespace madhuri\termsbundle\entity; use doctrine\orm\mapping orm; use doctrine\common\collections\arraycollection; /** * term * * @orm\table(name="terms") * @orm\entity */ class term { /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** * @var string * * @orm\column(name="termname", type="string", length=255) */ private $termname; /** * @var string * * @orm\column(name="description", type="string", length=2000) */ private $description; /** * @var string * * @orm\column(name="mnemonic", type="string", length=2000) */ private $mnemonic; /** * @var arraycollection * * @orm\onetomany(targetentity="relatedterm", * mappedby="term1") */ private $relatedterms; // /** // * @var arraycollection // * // * @orm\onetomany(targetentity="termexamples", // * mappedby="term") // */ // private $termexamples; public function __construct() { $this->relatedterms = new arraycollection(); $this->$termexamples = new arraycollection(); } /** * id * * @return integer */ public function getid() { return $this->id; } /** * related terms */ public function getrelatedterms() { return $this->relatedterms ; } /** * add related term */ public function addrelatedterm($relatedterm) { $this->relatedterms[] = $relatedterm; } /** * clear related terms */ public function clearrelatedterms() { $this->relatedterms->clear(); } /** * remove related term */ public function removerelatedterm($relatedterm) { $this->relatedterms->removeelement($relatedterm); } /** * term examples */ // public function gettermexamples() // { // return $this->termexamples ; // } // // /** // * add term example // */ // public function addtermexample($termexample) // { // $this->termexamples[] = $termexample; // } // // /** // * clear term examples // */ // public function cleartermexamples() // { // $this->termexamples->clear() ; // } // // /** // * remove term example // */ // public function removetermexample($termexample) // { // $this->termexamples->removeelement($termexample); // } /** * set termname * * @param string $termname * @return term */ public function settermname($termname) { $this->termname = $termname; return $this; } /** * termname * * @return string */ public function gettermname() { return $this->termname; } /** * set description * * @param string $description * @return term */ public function setdescription($description) { $this->description = $description; return $this; } /** * description * * @return string */ public function getdescription() { return $this->description; } /** * set mnemonic * * @param string $mnemonic * @return term */ public function setmnemonic($mnemonic) { $this->mnemonic = $mnemonic; return $this; } /** * mnemonic * * @return string */ public function getmnemonic() { return $this->mnemonic; } }
relatedterm.php
<?php namespace madhuri\termsbundle\entity; use doctrine\orm\mapping orm; /** * relatedterms * * @orm\table(name="related_terms") * @orm\entity */ class relatedterm { /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** * @var term * * @orm\manytoone(targetentity="term", * inversedby="relatedterm") */ private $term1; /** * @var term * * @orm\manytoone(targetentity ="term") */ private $term2; /** * @var string * * @orm\column(name="notes", type="string", length=2000, nullable=true) */ private $notes; /** * id * * @return integer */ public function getid() { return $this->id; } /** * term1 * * @return term */ public function getterm1() { if($this->term1) { return $this->term1; } else { return null; } } /** * set term1 * * @param term $term1 * * @return term */ public function setterm1(term $term1) { $this->term1 = $term1; return $this; } /** * term2 * * @return term */ public function getterm2() { return $this->term2; } /** * set term2 * * @param term $term2 * * @return term */ public function setterm2( term $term2) { $this->term2 = $term2; return $this; } /** * notes * * @return string */ public function getnotes() { return $this->notes; } /** * set notes * * @param string $notes * * @return term */ public function setnotes($notes) { $this->notes = $notes; return $this; } } ?>
Comments
Post a Comment