<?php

namespace Webkul\DamBundle\Connector\Reader;

use Webkul\DamBundle\Repository\AssetRepository;
use Webkul\DamBundle\Listener\ClassDefinationForCompatibility;

$versionCompatiblility = new ClassDefinationForCompatibility();
$versionCompatiblility->createClassAliases();
/**
 * AttributeColumn reader sorted by attribute and sort order.
 *
 * @author    Jitendra Singh <jitendra@webkul.com>
 * @copyright Webkul Software Pvt Ltd (https://www.webkul.com)
 */
class AssetReader extends \AbstractReader implements
    \ItemReaderInterface,
    \InitializableInterface,
    \StepExecutionAwareInterface
{
    /** @var AttributeColumnRepositoryInterface */
    protected $repository;

    /**
     * @param AttributeColumnRepositoryInterface $repository
     */
    public function __construct(AssetRepository $repository)
    {
        $this->repository = $repository;
    }

    /**
     * {@inheritdoc}
     */
    protected function getResults()
    {
        $data =  new \ArrayIterator($this->repository->findBy([], ['code' => 'ASC', 'starred' => 'ASC']));
        return $data;
    }
}
