0
私のプロジェクトではadodb ormとadodb activerecordを一緒に使いたいです。 $ dbプロパティでadodb ORMを、$ arプロパティでactiverecordを使用しています。私はクラスで両方を使用しています。adodb activerecordとormを一緒に使う方法
class Model {
public $ar ;
public $db;
function __construct() {
include('Model/adodb/adodb.inc.php');
$this->db = ADONewConnection($driver);
$this->db->Connect($server , $username , $password , $database) ;
include('Model/adodb/adodb-active-record.inc.php');
$ar = NewADOConnection("$driver://$username:[email protected]$server/$database");
$thid->ar = ADOdb_Active_Record::SetDatabaseAdapter($ar);
}
}
や記事テーブルクラス:仕事が、関数のgetTitleが動作しない権利記事クラス関数GETROWSで
<?php
class Posts extends Model
{
function getRows()
{
$re = $this->db->Execute('SELECT * From posts') ;
return $re->GetRows();
}
function getTitle()
{
$this->ar->load('id = 5');
return $this->ar->title;
}
}
これはメインのモデルクラスです。
どのように私は私のプロジェクトでそれらの両方を使用できますか?