RedBeanPHP\Finder::find PHP Method

find() public method

As with most Query tools in RedBean you can provide values to be inserted in the SQL statement by populating the value array parameter; you can either use the question mark notation or the slot-notation (:keyname).
public find ( string $type, string $sql = NULL, array $bindings = [] ) : array
$type string type the type of bean you are looking for
$sql string sql SQL query to find the desired bean, starting right after WHERE clause
$bindings array values array of values to be bound to parameters in query
return array
    public function find($type, $sql = NULL, $bindings = array())
    {
        if (!is_array($bindings)) {
            throw new RedException('Expected array, ' . gettype($bindings) . ' given.');
        }
        return $this->redbean->find($type, array(), $sql, $bindings);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @see Facade::find
  *      The findAll() method differs from the find() method in that it does
  *      not assume a WHERE-clause, so this is valid:
  *
  * R::findAll('person',' ORDER BY name DESC ');
  *
  * Your SQL does not have to start with a valid WHERE-clause condition.
  *
  * @param string $type     the type of bean you are looking for
  * @param string $sql      SQL query to find the desired bean, starting right after WHERE clause
  * @param array  $bindings array of values to be bound to parameters in query
  *
  * @return array
  */
 public static function findAll($type, $sql = NULL, $bindings = array())
 {
     return self::$finder->find($type, $sql, $bindings);
 }