doctrine2 - DoctrineFixtures and Symfony 2.7 -
i tried load fixtures using symphony 2.7.2 , got errors thus:
[invalidargumentexception] not find fixtures load in: - src/appbundle/datafixtures/orm/
i used link below guide, doesn't solve problem! https://symfony.com/doc/current/bundles/doctrinefixturesbundle/index.html
have had it?
thanks
here code:
<?php namespace appbundle\datafixtures\orm\blog; use doctrine\common\datafixtures\fixtureinterface; use doctrine\common\persistence\objectmanager; use appbundle\entity; class loadblogdata implements fixtureinterface { /** * {@inheritdoc} */ public function load(objectmanager $manager) { $blog = new blog(); $blog->settitulo('phasellus tempus pretium tellus convallis'); $blog->setdescricao('phasellus tempus pretium tellus convallis. curabitur erat lorem. morbi nisi nec mauris consequat accumsan. pellentesque lectus lectus, lobortis quis facilisis quis, imperdiet pharetra mauris. quisque eleifend pretium lectus vel blandit. in tempus, lectus condimentum finibus vehicula, diam ex varius nunc, et suscipit turpis dui sit amet elit.'); $blog->setconteudo("suspendisse sit amet finibus velit. suspendisse placerat pretium tellus, ut vehicula tortor malesuada ut. maecenas ornare maximus sem eu interdum. mauris @ dolor est. nam mollis velit augue, efficitur efficitur ligula malesuada a. ut blandit neque urna, rutrum lorem pretium id. morbi mi ligula, facilisis et enim in, tristique efficitur enim. vestibulum leo ipsum, facilisis ac lobortis et, tempus et tortor. nullam sed mauris sed magna euismod vulputate vel sed nulla. sed nisl dolor. nullam finibus cursus libero convallis pretium. praesent nibh dolor, congue sit amet tempor sed, fringilla rhoncus dolor. sed suscipit est erat, @ congue sapien rhoncus eget."); $manager->persist($blog); $manager->flush(); } }
my entity:
<?php namespace appbundle\entity; use doctrine\orm\mapping orm; /** * @orm\entity * @orm\table(name="blog") */ class blog { /** * @orm\column(type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @orm\column(type="string", length=100) */ protected $titulo; /** * @orm\column(type="string", length=400) */ protected $descricao; /** * @orm\column(type="text") */ protected $contudo; /** getters , setter goes here **/
my command line on terminal (mackbook - yosemite)
$ php app/console doctrine:fixtures:load --fixtures=src/appbundle/datafixtures/orm/ --append
i got it!
$ php app/console doctrine:fixtures:load --fixtures=src/appbundle/datafixtures/orm/ --append > loading appbundle\datafixtures\orm\loadblogdata
in loadblogdata.php used wrong use import
use appbundle\entity;
the right syntax it:
use appbundle\entity\blog;
symfony 2 amazing!
thank guys
Comments
Post a Comment