require_once 'Propel.php'; Propel::init("path/to/your/project-conf.php"); $product = ProductPeer::retrieveByPK(1); $product->setName("New Product Name"); $product->save();
require_once 'Propel.php'; Propel::init("path/to/your/project-conf.php"); $criteria = new Criteria(); $criteria->add(ProductPeer::PRICE, 50, Criteria::LESS_THAN); $products = ProductPeer::doSelect($criteria); foreach ($products as $product) { $product->setDiscount(10); $product->save(); }This code example updates the discount of all products that are priced less than 50. It first creates a criteria object with a condition that selects products with a price less than 50. It then retrieves all products that meet this criteria using the doSelect() method, and loops through each product to update its discount and save it. The BasePeer doUpdate() method is part of the Propel ORM (Object-Relational Mapping) library, which provides an easy-to-use interface for interacting with databases in PHP.