Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Clanver opened this issue Jan 9, 2018 · 0 comments
Open

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

Clanver opened this issue Jan 9, 2018 · 0 comments

Comments

@Clanver
Copy link

Clanver commented Jan 9, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant