php - zf2 + doctrine2 and No Metadata Classes to process -
i'm using tutorial http://www.nuvolia.com/2013/03/09/zend_framework_doctrine_install/. module application fork fine doctrine orm when i'm tring connect in module i'm reciving error:
d:\aptana studio\projects\app01>vendor\bin\doctrine-module orm:schema-tool:create deprecated: "symfony\component\console\helper\dialoghelper" deprecated since version 2.5 , removed in 3.0. use "symfony\component\console\helper\qu estionhelper" instead. in d:\aptana studio\projects\app01\vendor\symfony\console \helper\dialoghelper.php on line 34 no metadata classes process. d:\aptana studio\projects\app01>
application created skeleton, module has such code: /app01/module/myblog/config/module.config.php
<?php namespace myblog; return array( 'doctrine' => array( 'driver' => array( 'myblog_entity' => array( 'class' => 'doctrine\orm\mapping\driver\annotationdriver', 'cache' => 'array', 'paths' => array(__dir__ . '/../src/myblog/entity') ), 'orm_default' => array( 'drivers' => array( 'myblog\entity' => 'myblog_entity' ) ) ), 'eventmanager' => array( 'orm_default' => array( 'subscribers' => array( 'gedmo\timestampable\timestampablelistener', // 'gedmo\softdeleteable\softdeleteablelistener', // 'gedmo\translatable\translatablelistener', // 'gedmo\blameable\blameablelistener', // 'gedmo\loggable\loggablelistener', // 'gedmo\sluggable\sluggablelistener', // 'gedmo\sortable\sortablelistener', // 'gedmo\tree\treelistener', ), ), ) ) );
/app01/module/myblog/src/myblog/entity/blogpost.php
<?php namespace myblog\entity; //use doctrine\common\collections\arraycollection; use doctrine\common\collections\arraycollection; use doctrine\common\collections\collection; use doctrine\orm\mapping orm; use gedmo\mapping\annotation gedmo; class blogpost { /** * @var int * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @var string * @column(type="string", length=255, nullable=false) */ protected $title; /** * id. * * @return int */ public function getid() { return $this -> id; } /** * set id. * * @param int $id * * @return void */ public function setid($id) { $this -> id = (int)$id; } /** * title. * * @return string */ public function gettitle() { return $this -> title; } /** * set title. * * @param string $title * * @return void */ public function settitle($title) { $this -> title = $title; } }
/app01/module/myblog/module.php
<?php namespace myblog; class module { public function getautoloaderconfig() { return array( 'zend\loader\standardautoloader' => array( 'namespaces' => array( __namespace__ => __dir__ . '/src/' . __namespace__, //__namespace__ => __dir__ . '/src/' . str_replace('\\', '/' , __namespace__), ), ), ); } public function getconfig() { return include __dir__ . '/config/module.config.php'; } }
/app01/config/application.config.php
return array( // should array of module namespaces used in application. 'modules' => array( 'application', 'doctrinemodule', 'doctrineormmodule', 'zenddevelopertools', 'myblog' ),
/app01/config/autoload/doctrine.local.php
<?php return array( 'doctrine' => array( 'connection' => array( 'orm_default' => array( 'driverclass' =>'doctrine\dbal\driver\pdomysql\driver', 'params' => array( 'host' => 'localhost', 'port' => '3306', 'user' => 'zf2guard', 'password' => 'zf2guard', 'dbname' => 'app01', 'driveroptions' => array( \pdo::mysql_attr_init_command => 'set names utf8'), ) ) ), ), );
what wrong? why work in application module , not work in other module? try remove orm class (doctrine 2 no metadata classes process) nothing change. have ideas?
your entity not have @orm\entity
annotation. in case whole class skipped class-metadata annotationdriver.
/** * @orm\entity * @orm\table(name="blog_post") */ class blogpost { // ... }
Comments
Post a Comment