簡體   English   中英

集成Zend Framework 1和Doctrine 2

[英]Integrate Zend Framework 1 and Doctrine 2

我想在我的ZendFramework(v1.11)應用程序中使用Doctrine(v2.4),我從頭開始。 有一些文章描述了這種集成,但是它們看起來很復雜並且有些過時。 有沒有相當簡單的方法來連接ZF1和Doctrine2?

我已經將此實現為應用程序資源(擴展\\Zend_Application_Resource_ResourceAbstract

代碼很長,因此下面是要求的頂級檢查列表。

此處的示例使用注釋驅動程序:

$driver = new Driver\AnnotationDriver(
  new Annotations\CachedReader(new Annotations\AnnotationReader(), new  Cache\ArrayCache()), 
  $entityDirs
 );
 $config->setMetadataDriverImpl($driver);
  • 最后,將此新的配置實例傳遞給靜態實體管理器EntityManager::create

EG( $options這里是上面鏈接中示例的數據庫連接信息)

$entityManager = EntityManager::create($options['database'], $config);

看看我的完整資料,至少它會為您提供一個良好的開端:

https://github.com/alex-patterson-webdev/Multiverse/blob/master/lib/Multiverse/Application/Resource/Entitymanager.php

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM