<?php declare(strict_types=1);
/**
* gb media
* All Rights Reserved.
*
* Unauthorized copying of this file, via any medium is strictly prohibited.
* The content of this file is proprietary and confidential.
*
* @category Shopware
* @package Shopware_Plugins
* @subpackage GbmedEnev
* @copyright Copyright (c) 2019, gb media
* @license proprietary
* @author Giuseppe Bottino
* @link http://www.gb-media.biz
*/
namespace Gbmed\Enev\Core\Content\Enev;
use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection;
/**
* @method void add(EnevEntity $entity)
* @method void set(string $key, EnevEntity $entity)
* @method EnevEntity[] getIterator()
* @method EnevEntity[] getElements()
* @method EnevEntity|null get(string $key)
* @method EnevEntity|null first()
* @method EnevEntity|null last()
*/
class EnevCollection extends EntityCollection
{
/**
* return entity class name
*
* @return string
*/
protected function getExpectedClass(): string
{
return EnevEntity::class;
}
public function getActiveElements(): array
{
/** @var EnevEntity $element */
return array_filter($this->getElements(), function ($element) {
return $element->getActive();
});
}
public function hasActiveElements(): bool
{
return count($this->getActiveElements()) > 0;
}
}