How does thinkPHP implement ORM?

Source: Internet
Author: User
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);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.