Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bisna doctrine 2.1 & 2.2 The annotation "@Table" was never imported

I am used to using zend mvc together with doctrine 2.1 and 2.2 bound together with the bisna driver.

For the new project i'm using the annotation driver just for conveniance (i thout).How ever i've generated my entity's from the database and tryed loading them but they keep generating the error:

[Semantical Error] The annotation "@Table" in class MyWheels\Entity\Bmulog was never imported.

I tryed adding the ORM\ prefix to them but that does not solve it.

my config file read's:

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"

pluginPaths.Bisna\Application\Resource\ = "Bisna/Application/Resource"
autoloaderNamespaces[] = Bisna
autoloaderNamespaces[] = Doctrine
autoloaderNamespaces[] = MyWheels
autoloaderNamespaces[] = Symfony

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

resources.doctrine.cache.instances.default.namespace    = "Application_"
resources.doctrine.dbal.connections.default.parameters.dbname   = "mywheels"
resources.doctrine.dbal.connections.default.parameters.user = "root"
resources.doctrine.dbal.connections.default.parameters.password = ""
resources.doctrine.orm.entityManagers.default.metadataDrivers.drivers.0.adapterClass = "Doctrine\ORM\Mapping\Driver\AnnotationDriver"
resources.doctrine.orm.entityManagers.default.metadataDrivers.drivers.0.mappingNamespace = "MyWheels\Entity"
resources.doctrine.orm.entityManagers.default.metadataDrivers.drivers.0.mappingDirs[] = APPLICATION_PATH "\..\library\MyWheels\Entity"
resources.doctrine.orm.entityManagers.default.metadataDrivers.drivers.0.annotationReaderClass = "Doctrine\Common\Annotations\AnnotationReader" 

anyone any clue what's going wrong here?

my entity code is:

<?php

namespace MyWheels\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * MyWheels\Entity\Bmulog
 *
 * @Table(name="bmulog")
 * @Entity
 */
class Bmulog
{
    /**
     * @var integer $id
     *
     * @Column(name="id", type="integer", nullable=false)
     * @Id
     * @GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var text $request
     *
     * @Column(name="request", type="text", nullable=false)
     */
    private $request;

    /**
     * @var text $responce
     *
     * @Column(name="responce", type="text", nullable=false)
     */
    private $responce;

    /**
     * @var string $ip
     *
     * @Column(name="ip", type="string", length=200, nullable=false)
     */
    private $ip;

    /**
     * @var string $browser
     *
     * @Column(name="browser", type="string", length=200, nullable=false)
     */
    private $browser;

    /**
     * @var datetime $date
     *
     * @Column(name="date", type="datetime", nullable=false)
     */
    private $date;


}

Doctrine 2.2.0 results in about the same error:

[Semantical Error] The annotation "@Doctrine\ORM\Mapping\Table" in class MyWheels\Entity\Bmulog does not exist, or could not be auto-loaded.
like image 860
Bram Avatar asked Mar 11 '12 12:03

Bram


1 Answers

The use Doctrine\ORM\Mapping implies add the import alias as prefix of the Doctrine's annotation tags.

@ORM\Table
@ORM\Entity
@ORM\Column
@ORM\... (Any Doctrine annotation)
like image 171
Maks3w Avatar answered Sep 29 '22 07:09

Maks3w