RedBeanPHP\Finder::findAndExport PHP Method

findAndExport() public method

This method will perform a find-operation. For every bean in the result collection this method will call the export() method. This method returns an array containing the array representations of every bean in the result set.
See also: Finder::find
public findAndExport ( 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 findAndExport($type, $sql = NULL, $bindings = array())
    {
        $arr = array();
        foreach ($this->find($type, $sql, $bindings) as $key => $item) {
            $arr[] = $item->export();
        }
        return $arr;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @see Facade::find
  * The variation also exports the beans (i.e. it returns arrays).
  *
  * @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 findAndExport($type, $sql = NULL, $bindings = array())
 {
     return self::$finder->findAndExport($type, $sql, $bindings);
 }