I'm having problems using find*()
magic methods of Doctrine2 when the field has an underscore in between.
$repository->findByName("Hello"); // Works
$repository->findByIsEnabled(true);
Entity 'Acme\SecurityBundle\Entity\Package' has no field 'isEnabled'. You can therefore not call 'findByIsEnabled' on the entities' repository.
This is the simple entity definition in YAML for replicating the error:
Acme\SecurityBundle\Entity\Package:
type: entity
repositoryClass: Acme\SecurityBundle\Repository\PackageRepository
table: security_package
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
name:
type: string
length: 255
unique: true
is_enabled:
type: boolean
I recall having had the same problem and think I solved it by writing something like this :
Let's look at the code :
The key line is here:
Now let's have a look to classify :
It looks like you're supposed to write your fields "likeThis" if you want this to work.