 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Community News: A PHP 5.3 ActiveRecord
by Chris Cornutt May 23, 2009 @ 23:58:19
Jacques Fuentes has submitted some information about an ActiveRecord tool he's developed that's similar to the pattern found in Ruby On Rails and can be found here.
It is extremely similar to ActiveRecord for Ruby on Rails. We
believe our project is offering a better programming experience than
propel/doctrine since it does not require effort to get started.
Propel/doctrine both require that you use yaml/xml files or column
mapping in your model classes. We use show fields to 'magically' load
this in the background eliminating the tedious requirement of mapping
your schema to a file.
The code makes use of some of the features of the upcoming PHP 5.3 release (but won't work with versions prior to that). If you'd like to try it out, you can grab the code here.
voice your opinion now!
database activerecord php5
DevShed: The mysqli Extension and the Active Record Pattern
by Chris Cornutt April 15, 2009 @ 10:27:56
DevShed.com has posted the seventh article in their series looking at the Active Record design pattern in PHP applications. In this latest tutorial they show how to replace the older MySQL client libraries and use the newer mysqli client instead.
Well, as you'll surely recall, I built this class by using the old MySQL library included with the PHP distribution, which is good and efficient. But it's worth making the effort to see how this sample class can be rewritten by using the newer, revamped "mysqli" extension. Thus, this last episode will be dedicated exclusively to doing this, so you can have at your disposal an enhanced versions of the class.
For most of the code, you won't see too much of a change - the methods are named similarly and the results are references differently, but you shouldn't have to make too much of a change.
voice your opinion now!
extension mysqli activerecord design pattern tutorial
DevShed: Refactoring the MySQL Abstraction Class with the Active Record Pattern
by Chris Cornutt April 08, 2009 @ 07:56:18
DevShed has the latest article in their tutorial series looking at the Active Record design pattern posted today. This time they focus on a bit of refactoring to make their MySQL abstraction class a bit easier to use and work better.
As I stated in the end of the [previous] tutorial, however, some methods of this sample class implement redundant business logic, and as a consequence it's necessary to refactor them to fix this issue in a quick and simple manner. Thus, in the next few lines I'll be explaining how to accomplish this process progressively, and as always, accompanied by the corresponding code samples.
They change up some of the CRUD (Create, Read, Update, Delete) functions by dynamically constructing the SQL and updating the fetch functions to allow for more modifiers like "LIKE" or "LIMIT".
voice your opinion now!
refactor abstraction class activerecord design pattern tutorial
DevShed: The LIKE Clause and the Active Record Pattern
by Chris Cornutt March 24, 2009 @ 12:07:39
DevShed continues their look at the Active Record pattern with the next part of their seven part series - extending their MySQL class even further.
In its current incarnation, this class's functionality is limited, regardless of its decent level of SQL abstraction. Therefore, in this fourth part of the series I'm going to enhance it by making it capable of working with LIKE clauses in a straightforward way.
They look at using LIKE to match values in various columns of the tables and add in a fetchLike method that lets you specify the column to search, the pattern to match on and the table to search in.
voice your opinion now!
like clause tutorial activerecord pattern designpattern fetchlike
DevShed: Running Conditional Select Statements with the Active Record Pattern
by Chris Cornutt March 18, 2009 @ 07:58:54
DevShed continues their look at the Active Record pattern with this third part of the series focusing on a new method in their class that will make select requests for the Active Record layer.
If you're a PHP programmer who wants to learn how to implement the active record pattern within a MySQL abstraction class to make your database-driven applications more robust and maintainable, then look no further. [...] In this third chapter of the series I'm going to show you how to add a new method to the class. It will be charged with executing conditional SELECT statements via a modified version of the active record pattern.
After reviewing the CRUD functionality from the previous articles, they add in the new method - a fetchWhere function that allows the user to submit a table name and the parameters to add to the where clause as an array. Some sample code is included.
voice your opinion now!
activerecord designpattern pattern mysql layer abstraction fetchwhere
DevShed: Using the Active Record Pattern with PHP and MySQL
by Chris Cornutt March 05, 2009 @ 11:15:08
DevShed has started up a new series looking at one of the more popular software design patterns - the Active Record pattern. In this first part of the series they introduce the pattern and include a little code to get things started.
Using the active record pattern to develop a database-driven application offers many advantages. It can save PHP developers a wealth of time in coding and code maintenance, because you can take advantage of SQL abstraction.
First they set up a simple data mapping class (using methods like setFirstName to change the "firstname" property of the object) then a MySQL abstraction class and, in the last page of this first part, he combines the two to make a simple Active Record example.
voice your opinion now!
activerecord designpattern tutorial mysql datbase abstraction
DevShed: Working with the Active Record Class in Code Igniter
by Chris Cornutt September 17, 2008 @ 13:44:59
DevShed has posted the next part of their series focusing on the CodeIgniter framework. This new tutorial looks at the Active Record class that sits at the heart of the framework.
Welcome to the sixth installment of the series entitled "Introducing the Code Igniter PHP Framework." By using a hands-on approach, this series of articles walks you through the main features that come packaged with this friendly yet powerful development software that lets you quickly build robust PHP applications.
They show a simple example of how to pull information out of your database, how to get a little more complex with conditional select statements and how to use a where to narrow down your results.
voice your opinion now!
codeigniter framework activerecord tutorial series conditional
Bill Karwin's Blog: ActiveRecord does not suck
by Chris Cornutt May 29, 2008 @ 17:07:50
Bill Karwin (formerly of Zend and the Zend Framework project) has a new post to his blog defending one of the more abused (both in code and in opinions) design patterns, ActiveRecord:
ActiveRecord is fine. It is a tool that does just what it's designed to do. What sucks is when developers try to make it do other things than what it's intended to do.
He cites his work with the Zend_Db component and how Mike Seth gets it right when he says that the pattern shouldn't be "ActiveRecord-View-Controller". He compares the ideas of a true Model in an MVC application with the incorrect ideas that many developers seem to hold.
A Model is a class that provides a logical component of your application domain. Models are products of OO design, which is a development activity I see get very little attention in the developer blogosphere or the developer tools market.
Models can reference one or many (or no) database tables and are not where the hard work is being done. That's saved for the ORM (or ActiveRecord) to do.
voice your opinion now!
activerecord designpattern modelviewcontroller mvc model orm
|
Community Events
Don't see your event here? Let us know!
|