<?php

/**
 * Data Access Object (DAO) interface.
 * 
 * Contains basic methods to be implemented by any DAO class.
 * 
 * @author  $Author: pruna $
 * @package orm
 * @version $Revision: 1.3 $
 * @created 02-Apr-2005
 * @modified $Date: 2005/12/06 02:56:45 $
 */
interface OrmIDao {
    
    /**
     * Constructor. 
     *
     * @access  public
     * @param   mixed    $file    string or <em>OrmMap</em>
     * @param   mixed    $mixed   <em>OrmIDb</em>, <em>OrmBase</em>, dsn or null
     */
    public function __construct($file = null, $mixed = null);
    
    /**
     * Returns a Bean, based on PK lookup.
     * 
     * @see       load
     * @access    public
     * @param     mixed           $id    PK value to look for
     * @throws    OrmException    If not found
     * @return    object
     */
    public function get($id);
    
    /**
     * Returns an array of Beans.
     * 
     * @access   public
     * @param    mixed   $start      OrmSql as base query, or start index.
     * @param    int     $quantity   Quantity to return. Only if $start is int.
     * @return   array
     */
    public function getList($start = null, $quantity = null);
    
    /**
     * Insert action.
     * 
     * @access  public
     * @param   Bean         $bean      Bean where propagate action
     * @return  $bean
     */
    public function insert($bean);
    
    /**
     * Returns a Bean, based on PK lookup.
     * 
     * @see       get
     * @access    public
     * @param     mixed           $id    PK value to look for
     * @return    object
     */
    public function load($id);
    
    /**
     * Removes a bean.
     * 
     * @access  public
     * @param   Bean           $bean          Bean to save
     * @return  $bean
     */
    public function remove($bean);
    
    /**
     * Save action.
     * 
     * @access  public
     * @param   Bean         $bean      Bean where propagate action
     * @return  $bean
     */
    public function save($bean);
    
    /**
     * Returns an array of Beans, based on search criteria.
     * 
     * @access   public
     * @param    mixed     $search    OrmSql as base query, or a condition
     * @param    mixed     $vars      Vars to use in query
     * @return   array
     */
    public function search($search, $vars = null);
    
    /**
     * Update action.
     * 
     * @access  public
     * @param   Bean         $bean      Bean where propagate action
     * @return  $bean
     */
    public function update($bean);
    
}

?>