Closed astronati closed 1 year ago
Do you have a few entity managers configured in your project? Did you try to clear the cache, Is the error still the same?
Btw, could you dobule check the ResetPasswordRequest
entity, the properties inside should be declared with PHP attributes. Do you also use PHP attributes for your other entities? Or use annotations? You can't use both, so you would need to sync it.
Hi @bocharsky-bw,
The entity follows:
<?php
namespace App\Entity;
use App\Repository\ResetPasswordRequestRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ResetPasswordRequestRepository::class)]
class ResetPasswordRequest
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
public function getId(): ?int
{
return $this->id;
}
}
I understood what happened: the problem is due to the fact the entities in my project are under src\Domain\Entity and this bundle I suppose consider only entities under src\Entity, in fact the make command exits with error due to the fact it cannot find some files.
THE SOLUTION
Changing doctrine.yaml
as follows it worked
doctrine:
orm:
mappings:
App:
is_bundle: false
dir: '%kernel.project_dir%/src/'
prefix: 'App'
alias: App
Yes, the bundle is supposed your entities are following the default src/Entity/ dir. So, I think you just need to move the new entity in the proper dir and fix namespaces everywhere. Actually, the Maker bundles is supposed to generate entities in the default src/Entity/ too. So, if you're not using a standard path - you need to do some extra work after files are generated.
Thanks for sharing your solution with others! Can we close this issue now?
Yes, even if I would suggest to use the path set in the configuration.
Thanks.
Unfortunately, we just follow the logic of make:entity
command - that command also does not allow you to set up a different folder (mostly for simplicity reasons I suppose). So the issue is not directly related to this repo. But I'm happy to hear you found a workaround on it
Thanks @bocharsky-bw ! ;)
After run
bin/console make:reset-password
and answering some questions I get following error:Cannot find the entity manager for class "App\Entity\ResetPasswordRequest"