You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.
I was looking for more in-depth documentation, a wiki page, or other usage examples. I've searched StackOverflow for the bundle's name and looked at closed issues, but I couldn't find any more help on how to use this package apart from the seemingly old screenshot included in the readme.
I come from a Laravel background and my goal is to find a suitable alternative for Laravel artisan tinker in Symfony.
How can I access my application's code in PsyshBundle?
Here are my tries in the console. I obviously have a User entity and plenty of repositories, but it seems I cannot access or even locate them. Could you please help me with some configuration and usage examples?
bin/console psysh
<aside>Psy Shell v0.10.12 (PHP 7.4.26 — cli) by Justin Hileman</aside>
New version is available (current: v0.10.12, latest: v0.11.4)
>>> $container;
=> Symfony\Bundle\FrameworkBundle\Test\TestContainer {#909}
>>> $user = new User();
PHP Error: Class 'User' not found in Psy Shell code on line 1
>>> $container->get(EntityManagerInterface::class);
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException with message 'You have requested a non-existent service "EntityManagerInterface".'
>>> $container->get('doctrine')->getManager();
=> EntityManager_9a5be93 - Doctrine\ORM\EntityManager@proxy {#3016}
>>> $em = $container->get('doctrine')->getManager();
=> EntityManager_9a5be93 - Doctrine\ORM\EntityManager@proxy {#3016}
>>> $em->getRepository('UserRepository');
Doctrine\Persistence\Mapping\MappingException with message 'Class 'UserRepository' does not exist'
>>> $em->getRepository('App:Repository:UserRepository');
Doctrine\ORM\Exception\UnknownEntityNamespace with message 'Unknown Entity namespace alias "App"'
>>> $em->getRepository('App\Repository\UserRepository');
Doctrine\Persistence\Mapping\MappingException with message 'The class 'App\Repository\UserRepository' was not found in the chain configured namespaces App\Entity, Money'
>>> $em->getRepository('\User');
Doctrine\Persistence\Mapping\MappingException with message 'Class '\User' does not exist'
>>> $em->getRepository('User');
Doctrine\Persistence\Mapping\MappingException with message 'Class 'User' does not exist'
>>> $em->list();
PHP Error: Call to undefined method EntityManager_9a5be93::list() in Psy Shell code on line 1
>>> help
RuntimeException with message 'Too many arguments, expected arguments "command" "command_name".'
>>> $em
=> EntityManager_9a5be93 - Doctrine\ORM\EntityManager@proxy {#3016}
The text was updated successfully, but these errors were encountered:
I obviously have a User entity and plenty of repositories
But your user entity classname is probably not \User but App\Entity\User or something.
Laravel tinker extends psysh a bit to provide those sort of aliases but it was not clear to me how it was done so I never really found a way to implement this. I also wish the laravel team would try to contribute to tab completion support which I think would help a lot there but unfortunately there was never any interest in it.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi there,
I was looking for more in-depth documentation, a wiki page, or other usage examples. I've searched StackOverflow for the bundle's name and looked at closed issues, but I couldn't find any more help on how to use this package apart from the seemingly old screenshot included in the readme.
I come from a Laravel background and my goal is to find a suitable alternative for Laravel artisan tinker in Symfony.
How can I access my application's code in PsyshBundle?
Here are my tries in the console. I obviously have a User entity and plenty of repositories, but it seems I cannot access or even locate them. Could you please help me with some configuration and usage examples?
The text was updated successfully, but these errors were encountered: