Horde_Rdo_Mapper::exists PHP Method

exists() public method

Check if at least one object matches $query.
public exists ( mixed $query ) : boolean
$query mixed Either a primary key, an array of keys => values, or a Horde_Rdo_Query object.
return boolean True or false.
    public function exists($query)
    {
        $query = Horde_Rdo_Query::create($query, $this);
        $query->setFields(1)->clearSort();
        list($sql, $bindParams) = $query->getQuery();
        return (bool) $this->adapter->selectValue($sql, $bindParams);
    }

Usage Example

コード例 #1
0
ファイル: List.php プロジェクト: jubinpatel/horde
 /**
  * Implementation of the offsetExists() method for ArrayAccess
  * This method is executed when using isset() or empty() on Horde_Rdo_List objects
  * @param integer $offset  The offset to check.
  *
  * @return boolean  Whether or not an offset exists.
  */
 public function offsetExists($offset)
 {
     $query = Horde_Rdo_Query::create($this->_query);
     $query->limit(1, $offset);
     return $this->_mapper->exists($query);
 }