I downloaded and installed SyliusTaxonomiesBundle, and when I want to create a taxon (linked to a taxonomy), I get the following problem:
Catchable Fatal Error: Argument 1 passed to Sylius\Bundle\TaxonomiesBundle\Doctrine\ORM\TaxonRepository::getTaxonsAsList() must implement interface Sylius\Bundle\TaxonomiesBundle\Model\TaxonomyInterface, null given, called in /home/jeremy/web/vendor/sylius/taxonomies-bundle/Sylius/Bundle/TaxonomiesBundle/Form/Type/TaxonChoiceType.php on line 70 and defined in /home/jeremy/web/vendor/sylius/taxonomies-bundle/Sylius/Bundle/TaxonomiesBundle/Doctrine/ORM/TaxonRepository.php line 25
the problem at this level : https://github.com/pjedrzejewski/SyliusTaxonomiesBundle/blob/master/Form/Type/TaxonChoiceType.php
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$repository = $this->taxonRepository;
$choiceList = function (Options $options) use ($repository) {
$taxons = $repository->getTaxonsAsList($options['taxonomy']);
if (null !== $options['filter']) {
$taxons = array_filter($taxons, $options['filter']);
}
return new ObjectChoiceList($taxons);
};
$resolver
->setDefaults(array(
'choice_list' => $choiceList
))
->setRequired(array(
'taxonomy',
'filter'
))
->setAllowedTypes(array(
'taxonomy' => array('Sylius\Bundle\TaxonomiesBundle\Model\TaxonomyInterface'),
'filter' => array('\Closure', 'null')
))
;
}
and the method getTaxonsAsList is here : https://github.com/pjedrzejewski/SyliusTaxonomiesBundle/blob/master/Doctrine/ORM/TaxonomyRepository.php
class TaxonRepository extends EntityRepository implements TaxonRepositoryInterface
{
public function getTaxonsAsList(TaxonomyInterface $taxonomy)
{
return $this->getQueryBuilder()
->where('o.taxonomy = :taxonomy')
->andWhere('o.parent IS NOT NULL')
->setParameter('taxonomy', $taxonomy)
->orderBy('o.left')
->getQuery()
->getResult()
;
}
}
Can you help me please, thank you very much