Re: PHP MySQL object question
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Tue, 16 Sep 2008 21:16:23 -0400
AqD wrote:
On Sep 17, 8:43 am, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:AqD wrote:On Sep 16, 6:16 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:That's one way to do it. There are many others.AqDwrote:Simple objects, yes.On Sep 16, 5:05 am, William Gill <nore...@xxxxxxxxxxx> wrote:Nonsense. Writing simple db objects such as this is quite easy.boxoft wrote:It's easier to learn & use ORM rather than to write object<->dbHi,Both interesting, but I'm at a point right now where learning a new
Ruby on Rails implements ORM very well.
As for PHP,you might be interested inhttp://www.doctrine-project.org/.
Regards,
Box
boxoft...help people, serve people.
language, or application would be next to impossible.
interface by yourself ;)
How about this:
class Car
class SpecialCar extends Car
SELECT * FROM Car where color = 'red';
The list of result should include SpecialCar(s) and have them in
correct type (and all derived classes from 'Car').
And the driver (another class) and other properties in 'Car' should be
fetched, too. Being fetched with the result list (by join) or later
when they're actually accessed. The laziness of related objects must
also be customized, in model classes and/or in query.
And a .save method to save this object and all related ones (also
check for modification), and make inserts if needed.
That is what ORMs like Hibernate are supposed to do for you.
But even here you don't need an ORM to do your work. It is quite easy
to do it yourself.
Easy but a waste of time.
Why bother to write code by yourself when you can just use some
frameworks?
No waste of time at all. It takes me very little time to create the classes I need for a database. I've got a lot of skeleton code handy. But then I've been doing it for many years.
And my classes do what I need them to do efficiently. None of the extra overhead of your ORM, and custom validation of data is very easy.
I suspect it takes me less time to create the classes from my skeletons than it does you to implement the same code in Hibernate.
Products like Hibernate are good for beginning programmers; they are OK for programmers with fair experience. But few experts I know use them.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- PHP MySQL object question
- From: William Gill
- Re: PHP MySQL object question
- From: boxoft
- Re: PHP MySQL object question
- From: William Gill
- Re: PHP MySQL object question
- From: AqD
- Re: PHP MySQL object question
- From: Jerry Stuckle
- Re: PHP MySQL object question
- From: AqD
- Re: PHP MySQL object question
- From: Jerry Stuckle
- Re: PHP MySQL object question
- From: AqD
- PHP MySQL object question
- Prev by Date: Re: PHP MySQL object question
- Next by Date: Re: Online code editor for beginner's PHP class
- Previous by thread: Re: PHP MySQL object question
- Next by thread: Re: PHP MySQL object question
- Index(es):
Relevant Pages
|