**更新:これは、私がli3_doctrine2モジュールを使用していたリチウムのコピーとの非互換性に何らかの形で関連していることが判明しました。リチウムフレームワークリポジトリからプルし、ドクトリンモジュールをサブモジュールとして追加した後、正しく機能しているようです。また、以下のサンプルモデルとコントローラーを誤ってセットアップしたことを認識しています。
私はli3_doctrine2モジュールを使用してli3でDoctrine2を使用しようとしています。モジュールのgithubページの指示に従っていますが、エラーが発生し続けます。
Could not find adapter `pdo_mysql` in class `lithium\\data\\Connections'
phpinfoをチェックして、pdo_mysqlがロードされていることを確認しました。現在、\ li3_doctrine2 \ models\BaseEntityを拡張する基本モデルを使用しています。
namespace app\models;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Table;
/**
* @Entity
* @Table(name="cn_blog_entries")
*/
class BlogEntries extends \li3_doctrine2\models\BaseEntity {
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*/
protected $id;
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*/
protected $user_id;
/**
* @Id
* @GeneratedValue
* @Column(type="string")
*/
protected $title;
/**
* @Id
* @GeneratedValue
* @Column(type="string")
*/
protected $uristub;
/**
* @Id
* @GeneratedValue
* @Column(type="text")
*/
protected $content;
/**
* @Id
* @GeneratedValue
* @Column(type="datetime")
*/
protected $date_publish;
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*/
protected $active;
/**
* @Id
* @GeneratedValue
* @Column(type="datetime")
*/
protected $timestamp_created;
/**
* @Id
* @GeneratedValue
* @Column(type="datetime")
*/
protected $timestamp_updated;
}
私のコントローラーでは、テストのためにかなり基本的なものにしています。
<?php
namespace app\controllers;
use app\models\BlogEntries;
// use app\models\BlogEntryTags;
class BlogController extends \lithium\action\Controller {
public function index() {
$entries = BlogEntries::getRepository()->findBy();
var_dump($entries);
}
}
私はこの問題に何週間も戻ってきました。私がそれを理解できない場合、それは私にとってリチウムにDoctrine2がないことを意味すると思います。リチウムのORMがより良い関係サポートを持っていたらいいのにと思います!