I have problem with use Doctrine\ORM\Mapping as ORM; I create project in Symfony2 and create some table in mysql. Then i import ENtities with:
php app/console doctrine:mapping:import AcmeMainBundle annotation
next, i generate entities
php app/console doctrine:generate:entities AcmeMainBundle
all looking good:
<?php
namespace Acme\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Article
*
* @ORM\Table(name="article")
* @ORM\Entity
*/
class Article
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
.....
But, this orm not working. When I try use Repository:
* @ORM\Entity(repositoryClass="Acme\MainBundle\Repository\ArticleRepository")
and in there create own select with QueryBuilder, i dont see this function. In Controller I try see methods with:
var_dump(get_class_methods($this->getDoctrine()->getManager()->getRepository('AcmeMainBundle:Article')));
but return of this is only:
array (size=12)
0 => string '__construct' (length=11)
1 => string 'createQueryBuilder' (length=18)
2 => string 'createNamedQuery' (length=16)
3 => string 'createNativeNamedQuery' (length=22)
4 => string 'clear' (length=5)
5 => string 'find' (length=4)
6 => string 'findAll' (length=7)
7 => string 'findBy' (length=6)
8 => string 'findOneBy' (length=9)
9 => string '__call' (length=6)
10 => string 'getClassName' (length=12)
11 => string 'matching' (length=8)
without my function, after I find then any ORM dont working, when I try doing error in annotation
/**
* Article
*
* @ORM\XXXXXXXXXXXXXXXXXTable(name="article")
* @ORM\Entity
*/
I dont back any error.
I install Symfony2 and doctrine on Windows8 with composer with latest composer.json, all instalation step doing correctly.
app/autoload.php is:
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;
/**
* @var ClassLoader $loader
*/
$loader = require __DIR__.'/../vendor/autoload.php';
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;
I dont know when I find this error. Entity working, but ORM mapping dont. Pls show me com clue, when I may find.
Thanks Stoupa
php app/check.phpto check if your installation is good enough to run symfony2. - danio1024