jmunozco jmunozco - 11 days ago 9
PHP Question

Attempted to load class "Doctrine_Core"

I'm trying to follow these steps:
http://docs.doctrine-project.org/projects/doctrine1/en/latest/en/manual/hierarchical-data.html

Please, correct me if I am wrong. Firstly, I've created this class in AppBundle/Model route:

namespace AppBundle\Model;


class Item extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 255);
}

public function setUp()
{
$this->actAs('NestedSet');
}
}


And then I use it in a controller like this:

$treeObject = Doctrine_Core::getTable('Category')->getTree();


I have two questions:
- Where do I have to define the Category table and how
- With this previous code I ran into this error: Attempted to load class "Doctrine_Core" from namespace "AppBundle\Controller\Admin

Any idea please? Thanks

Answer

Doctrine has it's bundle for Symfony, that allows to store all config data in YML. https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html - it has "Tree extension" and it is what you're looking for.