Files
core/src/Storage/Query/TaxonomyQueryResultset.php
Xiao Hu Tai 94ae4e0604 Add Bolt\Storage\Query and Bolt\Twig\TwigRecordsView from Bolt 3
This is commit c3ead6d48cc2431d72ae7f81947df7fa5fefa92b in
https://github.com/bolt/bolt

Copied on 2018-10-30 14:00

Once Query works, it could be refactored from `Bolt\Storage\Query`
to `Bolt\Query`
2018-12-13 10:28:01 +01:00

41 lines
847 B
PHP

<?php
namespace Bolt\Storage\Query;
use Bolt\Storage\Collection\LazyCollection;
use Bolt\Storage\EntityManager;
use Bolt\Storage\EntityProxy;
/**
* This class builds on the default QueryResultset to add
* the ability to merge sets based on weighted scores.
*/
class TaxonomyQueryResultset extends QueryResultset
{
protected $em;
public function getCollection()
{
$collection = new LazyCollection();
foreach ($this->results as $proxy) {
$collection->add(new EntityProxy($proxy['contenttype'], $proxy['id'], $this->getEntityManager()));
}
return $collection;
}
public function setEntityManager(EntityManager $em)
{
$this->em = $em;
}
/**
* @return EntityManager
*/
public function getEntityManager()
{
return $this->em;
}
}