// Using the createSelectSql method to generate a SQL query $sql = BasePeer::createSelectSql('User'); $sql->addJoin(User::GROUP_ID, Group::ID); $sql->addJoin(Group::ORGANIZATION_ID, Organization::ID); $sql->addSelectColumn(User::NAME); $sql->addSelectColumn(Group::NAME); $sql->addSelectColumn(Organization::NAME); $sql->addAscendingOrderByColumn(User::NAME); // The above code generates a SQL query to select user, group and organization names, // as well as join them based on their respective IDs and order the results by user name.
// Using createSelectSql method to generate a SQL query with specific conditions $sql = BasePeer::createSelectSql('Product'); $sql->addWhere(Product::PRICE, 30, Criteria::GREATER_THAN); $sql->addOrderBy(Product::NAME, Criteria::ASC); $sql->setLimit(10); // The above code generates a SQL query to select products with a price greater than 30, // order the results by product name and limit the results to 10.The BasePeer class is a part of the Propel ORM library for PHP, which is a high-performance Object-Relational Mapping (ORM) system that supports both relational and NoSQL database systems.