How do Peer and Query classes in Symfony 1.4 contribute to efficient web development?
Peer and Query classes in Symfony 1.4 contribute to efficient web development by providing an object-oriented approach to interacting with the database. They abstract away the complexities of writing SQL queries directly, making it easier to retrieve and manipulate data from the database. This can lead to cleaner, more maintainable code and reduce the risk of SQL injection vulnerabilities.
// Example of using Peer and Query classes in Symfony 1.4
// Retrieve data from the database using Peer class
$users = UserPeer::doSelect(new Criteria());
// Manipulate data using Query class
$query = new Criteria();
$query->add(UserPeer::NAME, 'John');
$johnUsers = UserPeer::doSelect($query);