开发者

PHP: ORM framework or library that I can use with my database table structure

I was using KohanaPHP ORM but I can't use it with my database table structure. So, I need a framework or library ORM to use with it.

With Kohana I need to follow a naming convention. I can't use a field name (foreign key) like 'idUnidadeMedida'.

Are there any suggestions?

Thank you.


<?开发者_StackOverflowphp
class Model_Produto extends ORM {
    protected $_table_name = 'produtos';
    protected $_primary_key = 'pro_codigo';
    protected $_has_one = array('unidade' => array('model' => 'unidade', 'foreign_key' => 'uni_codigo'));
}
?>

<?php
class Model_Unidade extends ORM {
    protected $_table_name = 'unidades';
    protected $_primary_key = 'uni_codigo';
}
?>


Actually, Kohana ORM isn't that limited. In case of Ko3's ORM, you can define everything concerning your relationships as I explained here;

How do I relate tables with different foreign key names in Kohana ORM?

( look at the code, not explanation, since that guy asked for varchar FKs )


Doctrine is PHP's most powerful ORM (and database abstraction layer) - there's not much it can't do. V2 (soon to be released) may well become the de-facto standard, and will see integration with frameworks (i.e. Zend, although it's easily used stand-alone too).

  • Doctrine 2 Preview release
  • Slideshare presentation
  • Wiki Overview
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜