in reply to Re^2: A Growing Dislike for SQL-OOP Mappers
in thread A Growing Dislike for SQL-OOP Mappers
The problem has nothing to do with SQL-OOP mapping; it's just general OOP. In the end, if you override create and another Class::DBI method (such as find_or_create) calls $self->create, it is perfectly natural that it will call your overriden method. That's what polymorphism is all about.
Think about it the other way: if it worked the way you want, someone would soon complain that they overrode create and called find_or_create expecting it to call their overriden create, but it didn't.
If you create an infinite loop or somesuch thing by overriding create, you should reconsider your strategy. You can either override find_or_create as well, or hack your method to keep state so that it breaks out of the loop.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: A Growing Dislike for SQL-OOP Mappers
by jk2addict (Chaplain) on Aug 22, 2005 at 21:33 UTC | |
by perrin (Chancellor) on Aug 22, 2005 at 23:16 UTC | |
by TimToady (Parson) on Aug 23, 2005 at 00:11 UTC | |
by itub (Priest) on Aug 22, 2005 at 22:28 UTC |
In Section
Meditations