protected function getTaxonomy($content)
{
$tablename = $this->getTablename("taxonomy");
$ids = array_column($content, 'id');
if (empty($ids)) {
return;
}
// Get the contenttype from first $content
$first = reset($content);
$contenttype = $first->contenttype['slug'];
$taxonomytypes = $this->app['config']->get('taxonomy');
// If there are no taxonomytypes, there won't be any results, so we return.
if (empty($taxonomytypes)) {
return;
}
$query = sprintf("SELECT * FROM %s WHERE content_id IN (?) AND contenttype=? AND taxonomytype IN (?)", $tablename);
$rows = $this->app['db']->executeQuery($query, [$ids, $contenttype, array_keys($taxonomytypes)], [DoctrineConn::PARAM_INT_ARRAY, \PDO::PARAM_STR, DoctrineConn::PARAM_STR_ARRAY])->fetchAll();
foreach ($rows as $row) {
$content[$row['content_id']]->setTaxonomy($row['taxonomytype'], $row['slug'], $row['name'], $row['sortorder']);
}
foreach ($content as $key => $value) {
$content[$key]->sortTaxonomy();
}
}