News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Jamie Rumbelow's Blog:
Named Scopes with CodeIgniter
January 07, 2010 @ 12:20:20

Jamie Rumbelow has proposed an idea to help simply some of the interactions your CodeIgniter application can have with your databases by using named scopes.

Named scopes are a really powerful feature of models - they allow you to define a clean, concise syntax when performing queries within your models - and best of all, are really easy to utilize in CodeIgniter. The main principle of a named scope is that you create a method that, combined with method chaining, allows you to add details to your query (generally additional WHERE clauses).

He shows two "before and after" examples of multi-line requests condensed down by making a custom model layer with methods containing the commonly used portions of the database calls and returning the "$this" object so it can be used for chaining.

0 comments voice your opinion now!
named scopes codeigniter framework


blog comments powered by Disqus

Similar Posts

Reign's SourceRally Blog: The PHP coder's top 10 mistakes and problems

Matthew Weier O'Phinney's Blog: Symfony Live 2010 (A message of Interoperability)

Zend Developer Zone: Zend Framework Code Freeze (0.6.0 is Coming)

Nay Pryce's Blog: "Dependency Injection" Considered Harmful

Richard Thomas' Blog: A Quick Taste - Solar Framework Model Flexability and Power


Community Events





Don't see your event here?
Let us know!


install tips community laravel release bugfix framework deployment introduction series podcast opinion language interview symfony voicesoftheelephpant list api package library

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework