<?

require_once("classes/User.class.php");
require_once(
"classes/Cart.class.php");
require_once(
"classes/Product.class.php");

require_once(
"header.php");

    
/**
     * We use the "query by example" or QBE technique to retrieve the cart by its owners email.    
     * 
     * We create an example object, populating its fields with the values we want matched, 
     * and sending the example object to the phpersistence query system.
     *      
     * phpersistence will return the object that look like the example.
     */  
    
$userExample = new User();
    
$userExample->mail "michael@phpersistence.org";
    
$cartExample = new Cart();
    
$cartExample->user $userExample;
    
    
// Lets get it
    
$persistence = new Persistence();
    
$cartsFound $persistence->findByExample($cartExample);
    
    
$currentCart $cartsFound[0];
    
    
Logger::debug($currentCart);
    
?>