How does PHP implement ORM? Similar to Hibernate? What frameworks or class libraries can be used for implementation? How does PHP implement ORM? Similar to Hibernate? What frameworks or class libraries can be used for implementation?
Reply content:
How does PHP implement ORM? Similar to Hibernate? What frameworks or class libraries can be used for implementation?
Doctrine and annotation can be used for a more comprehensive function.
Yii, CakePHP ......
Isn't it the official PDO class? Http://cn2.php.net/manual/zh/book.pdo.phpX3X
(I always thought that ORM and database operations are a meaning, and then I arbitrarily said PDO, Keke )...
Answer the main purpose of this question is to recommend the class library, I usually use this http://medoo.in, I think it is very good oh, by the way, is written by the http://catfan.me.
A considerable number of mainstream frameworks use the orm implemented by Active Record,
Recommended: http://www.notorm.com/
PS: PHP does not have a real ORM.
Can Try arraydb, this is infoq introduction to arraydb http://www.infoq.com/cn/articles/arrayDB
We recommend that you use a short and concise ActiveRecord library, such as loydzhou/activerecord-GitHub, to implement relation similar to Yii. Document address: http://lloydzhou.github.io/activerecord/
class User extends ActiveRecord{ public $table = 'user'; public $primaryKey = 'id'; public $relations = array( 'contacts' => array(self::HAS_MANY, 'Contact', 'user_id') );}class Contact extends ActiveRecord{}$user = new User();// find one uservar_dump($user->notnull('id')->orderby('id desc')->find());echo "\nContact of User # {$user->id}\n";// get contacts by using relation:// 'contacts' => array(self::HAS_MANY, 'Contact', 'user_id'),var_dump($user->contacts);