- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用教程 http://www.nuvolia.com/2013/03/09/zend_framework_doctrine_install/ .模块 Application fork 与 Doctrine ORM 很好,但是当我尝试连接到另一个模块时,我收到错误:
d:\Aptana Studio\Projects\app01>vendor\bin\doctrine-module orm:schema-tool:create
Deprecated: "Symfony\Component\Console\Helper\DialogHelper" is deprecated since
version 2.5 and will be 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 to process.
d:\Aptana Studio\Projects\app01>
我从骨架创建的应用程序,模块有这样的代码:/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 as ORM;
use Gedmo\Mapping\Annotation as 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;
/**
* Get id.
*
* @return int
*/
public function getId() {
return $this -> id;
}
/**
* Set id.
*
* @param int $id
*
* @return void
*/
public function setId($id) {
$this -> id = (int)$id;
}
/**
* Get 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(
// This should be an array of module namespaces used in the 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'),
)
)
),
),
);
我做错了什么?为什么它在应用程序模块中工作,而在其他模块中不工作?我尝试从我的类 ( doctrine 2 no metadata classes to process ) 中删除 ORM,但没有任何改变。你有什么想法吗?
最佳答案
您的实体没有 @ORM\Entity
注释。在那种情况下,类元数据 AnnotationDriver 会跳过整个类。
/**
* @ORM\Entity
* @ORM\Table(name="blog_post")
*/
class BlogPost
{
// ...
}
关于php - zf2 + doctrine2 和没有要处理的元数据类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30557468/
当我像这样使用 zend CLI 创建表单时,会生成一个表单并将其添加到表单文件夹中。 zf create form MyForm 我有一个自定义类,我想以相同的方式为其创建一个自定义命令,并希望查看
我有一个以 user_id 作为主键的用户表和一个以 user_date_id 作为主键的 user_dates 表,user_id 链接到用户表以及 start_date 和 end_date 字段
我得到了这个代码 $select ->from(array("e" => "embarcacoes")) ->join(array("i
我遇到了 PHP 和 Zend Framework 的这个小问题。 我使用 apt-get install libzend-framework-php 安装了 ZF它还安装了二进制 zf.sh和 ze
我有一小段(x86)程序集,我试图弄清楚它的作用。 ... 6: 81 ec 00 01 00 00 sub $0x100, %esp c: 31 c9
我正在将 ZF 用于 MVC 应用程序,并且对我的代码应该如何构建感到非常困惑。 我有一个过程应用程序,它基本上是 1 个巨大的长文件,其中包含我希望我的应用程序执行的所有功能......例如:get
我的身份验证适配器如下所示 $authAdapter->setTableName('register') ->setIdentityColumn('u
我们最近开始使用 Doctrine 2.2 和 Zend Framework 2 的一部分,以努力改进组织、减少重复等。今天,我开始提出实现服务层的想法,以充当我们的 Controller 和 Doc
我是 phpunit 测试的新手。任何人都可以帮助我如何测试图像中下面的行。 到目前为止我的测试是: public function testCanSendEmail() { $formDat
我正在尝试写这个,用 zf select 查询但没有成功 SELECT * FROM `subscribers` WHERE id IN (Select subscriber_id From gs_r
我正在使用 Zend Framework 的 Zend_Db_Table从数据库中获取数据的类。 我想通过向表中添加一些内容来“优化”我从表中获取的每一行。在一个普通的旧 SQL 查询中,我会写例如。
我正在尝试使用 Zend_Db 进行与此类似的更新: UPDATE `TABLE` SET column = column + 'new value' WHERE foo = 'bar' 你们
cmpxchg 的操作伪代码如下(Intel® 64 and IA-32 Architectures Software Developer's Manual, Volume 2A: Instructi
我正在使用具有 REST API 的 ZF 开发应用程序。一切都很顺利,除了我的 XML 在开头有一个空白字符,所以 XML 打破了在开头有 XML 声明的规则。我正在尝试使用 javascript/
这段代码是否给了我最后插入的记录 id,即使在重载页面上? db = Zend_Db_Table::getDefaultAdapter(); $db->insert($this->_name,
为什么 lists:zf/2 是 Erlang 中 filtermap/2 的别名? 这是列表中未记录但已导出的函数:模块。这是实现: zf(F, L) -> filtermap(F, L).
我正在 x86 上调试我的代码,问题追溯到 AND 指令如果结果不为零,有时不会清除 ZF 标志。这是有问题的代码: 0257A9F9 mov edx,dword ptr [ecx+
我需要使用一些没有 GCC 内在函数的 x86 指令,例如 BSF 和 BSR。使用 GCC 内联汇编,我可以编写如下内容 __INTRIN_INLINE unsigned char bsf64(un
我在将复选框包装到标签中时遇到了 Zend 装饰器 (ZF1) 的一些问题。 在我的表格中,我有一些非常简单的东西: $remember = new Zend_Form_Element_Checkbo
我有一个简单的查询,但我一辈子也想不通。 我有一个包含“thread_id”和“messages”列的(简化的)“messages”表 我还有一个线程列表,每个线程需要 10 个结果。 $list =
我是一名优秀的程序员,十分优秀!