mirror of
https://github.com/flextype/flextype.git
synced 2025-08-12 08:04:05 +02:00
feat(element-queries): restore back doctrine collections #436
This commit is contained in:
@@ -88,13 +88,6 @@ class Collection
|
||||
*/
|
||||
private $criteria;
|
||||
|
||||
/**
|
||||
* Error Reporting
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private $errorReporting;
|
||||
|
||||
/**
|
||||
* Create a new collection.
|
||||
*
|
||||
@@ -488,13 +481,13 @@ class Collection
|
||||
public function all() : array
|
||||
{
|
||||
// Mute notices if there is no requested fields to search inside the items.
|
||||
error_reporting($errorReporting = error_reporting() & ~E_NOTICE);
|
||||
//error_reporting($errorReporting = error_reporting() & ~E_NOTICE);
|
||||
|
||||
// Match collection
|
||||
$collection = $this->collection->matching($this->criteria);
|
||||
|
||||
// Restore error_reporting
|
||||
error_reporting($errorReporting);
|
||||
//error_reporting($errorReporting);
|
||||
|
||||
// Gets a native PHP array representation of the collection.
|
||||
$results = $collection->toArray();
|
||||
|
23
src/flextype/Support/helpers.php
Normal file
23
src/flextype/Support/helpers.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Flextype (http://flextype.org)
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
use Flextype\Support\Collection;
|
||||
|
||||
|
||||
if (! function_exists('collect')) {
|
||||
/**
|
||||
* Create a collection from the given value.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
function collect($items) : Collection
|
||||
{
|
||||
return new Collection($items);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user