public function dump()
{
if (!method_exists($this->filesystem, 'dumpFile')) {
throw new \RuntimeException('Method dumpFile() is not available on your Filesystem component version, you should upgrade it.');
}
$this->initDirection();
$feed = $this->feedManager->get($this->name);
if ($this->entity) {
$repository = $this->em->getRepository($this->entity);
$items = $repository->findBy([], $this->orderBy, $this->limit);
$feed->addFromArray($items);
} elseif ($feed->hasItems()) {
throw new \LogicException(sprintf('An entity should be set OR you should use setItems() first'));
}
$dump = $feed->render($this->format);
$filepath = $this->rootDir . $this->filename;
$this->filesystem->dumpFile($filepath, $dump);
}