1
0
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:
Awilum
2020-07-19 11:19:05 +03:00
parent 6a4b0734c4
commit 080ccd63ed
2 changed files with 25 additions and 9 deletions

View File

@@ -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();

View 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);
}
}