~/dev/domain.lan/src/ProductBundle/DataFixtures/ORM/ProductF ixture.php
<?php
namespace ProductBundle\DataFixtures\ORM;
use Doctrine\Bundle\FixturesBundle\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use ProductBundle\Entity\Product;
class ProductFixture implements FixtureInterface
{
public function load(ObjectManager $manager)
{
// create 20 products! Bam!
for ($i = 0; $i < 20; $i++) {
$product = new Product();
$product->setName('Product name' . $i);
$manager->persist($product);
}
$manager->flush();
}
}
Das Problem ist gelöst, es war notwendig, um einen Dienst hinzuzufügen: (app/config/services.yml)
services:
# Product service
ProductBundle\:
resource: '../../src/ProductBundle/*'
exclude: '../../src/ProductBundle/{Entity,Repository,Tests}'
Wo sind Ihre Armaturen? Welches Verzeichnis? Könnte den Code –
zeigen Ihre Armaturen sollten z.B. in 'src \ AppBundle \ DataFixtures \ ORM \ MyFixture.php' – baris1892
Patch: ~/dev/domain.lan/src/ProduktBundle/DataFixtures/ORM/ProductFixture.php Website Root: ~/dev/domain.lan/ – Alexander