Skip to content

SQl Error on get_class and dql with config[root] always empty #10

@Clanver

Description

@Clanver

Hey, nice work here.
After fumbling with the configurations i got everthing to work.

But i needed to change up two things in my own bundle to get it to work. Not sure why though . . might be my own inability but i will describe it either way. Maybe someone can explain what i did wrong?

So after configuring everything for the "StofDoctrineExtensionsBundle" my category entity just would not show a category tree properly. The ajax always returned a SQL Error.

SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: ""
in vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php (line 95)

I followed the error in the code and it seemed like my CategoryAdmin class returned something wrong in the getClass() method.

So i´ve overwritten it and returned the proper entity class since it is used later to get the repository.

Fine, now it works, but always returns an empty array. . .

After looking into it, it seems like the NestedTreeRepository just cant find anything when a root is configured.

if (isset($config['root'])) { $qb->andWhere($qb->expr()->eq('node.'.$config['root'], ':rid')); $qb->setParameter('rid', $wrapped->getPropertyValue($config['root'])); }
Since the root field is always empty in my database, it wont find anything. Dont really know when the root field is written. I cant write it manually ..

So i removed the root configuration in my xml config:
gedmo:tree-root/ <<< removed

Now it properly works, but im not sure if what ive done was ok.

Did someone have similar problems?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions