Hi all,
I am trying to set up Doctrine 2 Orm for a self made MVC framework, but keep hitting the same error when trying to retrieve data:
Fatal error: Uncaught exception 'Doctrine\ORM\Mapping\MappingException' with message 'Class "App\models\menu" is not a valid entity or mapped super class.' in C:\wamp\www\framework\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\MappingException.php on line 336
I am using composers autoloader (PSR-4).
My setup for Doctrine is like this:
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
use App\framework\core\database\entityInstance;
$paths = array( '/app/models' );
$isDevMode = false;
// the connection configuration
$dbParams = array(
'driver' => 'pdo_mysql',
'user' => 'root',
'password' => '',
'dbname' => 'db_name',
);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create($dbParams, $config);
entityInstance::setManager( $entityManager );
I have a model that lookes like this:
namespace App\models;
use App\framework\core\database\entityInstance as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="generator_menus")
*/
class menu
{
public static function test()
{
$db = ORM::getManager();
$menu = $db->find('App\models\menu', 1 );
die( var_dump( $menu ) );
# $menu = $db->find('MyProject\Domain\User', $id);
# $menu = $db->find('menu', 1);
return $menu;
}
}
I keep getting the same exceptions, and am obviously using/setting this up in a terrible way.
Anyone that know how to configure this?
Regards, Klemme