|
Posted by petermichaux on 10/14/05 06:20
Hi,
I'd like to be convinced otherwise but I have been reading about Propel
and similar packages and these packages seem like a waste of time.
Quotes from the Propel site.
"Propel makes applications easier to write"
To use Propel there is a bunch of overhead to prepare by making an XML
document describing the database. That seems like a real pain during
development especially if the database is changing along the way.
- - - -
"Propel enables you to perform complex queries and database
manipulations without writing a single SQL clause."....."The Criteria
class is able to build commonly used queries, but it does not pretend
to be capable of building any query. In cases where you need to perform
particularly complex queries you will need to write your own SQL
statements. "
First, why avoid SQL? I think it is the simplest part of a web app to
read. Even a complicated query is still a small self-contained
statement. Second, even if I want to use Propel to avoid SQL and if I
have a complicated SQL query then I'll still have to write SQL.
- - - -
///PROPEL CODE
$cton1 = $c->getNewCriterion(AuthorPeer::FIRST_NAME, "Leo",
Criteria::NOT_EQUAL);
$cton2 = $c->getNewCriterion(AuthorPeer::LAST_NAME,
array("Tolstoy", "Dostoevsky", "Bakhtin"),
Criteria::IN);
$cton1->addOr($cton2);
$c->add($cton1);
$results = AuthorPeer::doSelect($c);
foreach($results as $author) {
print "Author: " . $author->getLastName() . ", " .
$author->getFirstName() . "\n";
}
///SQL with PEAR DB
$result = $db->getAll("SELECT * FROM author WHERE first_name!='Leo' OR
last_name IN ('Tolstoy', 'Dostoevsky', 'Bakhtin')");
foreach($results as $author) {
print "Author: " . $author['last_name'] . ", " .
$author['first_name'] . "\n";
}
///To me the plain SQL with PEAR DB version is much easier to read.
- - - - - -
So what am I missing? People are spending a lot of time developing
Propel. I don't get it.
-Peter
Navigation:
[Reply to this message]
|