dachcom-digital / pimcore-lucene-search

Pimcore Website Indexer (powered by Zend Search Lucene)
Other
26 stars 20 forks source link

No database connection for the categories class #54

Closed manuelkleinert closed 6 years ago

manuelkleinert commented 6 years ago

I need categories from the Pimcore objects. Unfortunately I don't have access to the class category.

AppBundle\LuceneSearch\Services\Categories

    public function getCategories() : array
    {
        $categoryArray = [];

        array_push($categoryArray, ['id' => 1, 'label' => 'Blog']);
        array_push($categoryArray, ['id' => 2, 'label' => 'Support']);
        array_push($categoryArray, ['id' => 3, 'label' => 'Project']);

        $catList = new DataObject\....\Listing(); // -> ERROR (Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function get() on null in /var/www/html/pimcore/lib/Pimcore/Db.php on line 51) 
        foreach ($catList as $cat) {
            array_push($categoryArray, ['id' => $cat->getId(), 'label' => $cat->getName()]);
        }

        return $categoryArray;
    }
solverat commented 6 years ago

hey @manuelkleinert fixed in 2.0.2!

manuelkleinert commented 6 years ago

Thank you very much @solverat