ORM with PHP

Yes, in my opinion PHP is still one of the best solution to build complex web 2.0 applications.

There are a lot of great PHP Frameworks out there which makes your life easier (Symfony, CakePHP, Codeigniter, and more…).

Now you can enjoy 100% Object-relational mapping in PHP by using IgnitedRecord library under the Codeigniter framework.

Here is a snapshot of how ORM can be achieved with PHP:

$this->load->model(‘ignitedrecord/ignitedrecord’);

$this->post = IgnitedRecord::factory(‘posts’);
$this->post->belongs_to(‘user’)->fk(‘author’);

$posts = $this->post->like(‘CodeIgniter’)
->order_by(‘date’, ‘desc’)
->join_related(‘user’)
->find_all();

foreach($posts as $post){
echo $post->title;
echo $post->user_username;
}

Artemis Mendrinos

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top