So, I'm now trying to do a simple search using Symfony2 and Doctrine. Something similar to this: http://docs.doctrine-project.org/projects/doctrine1/en/latest/en/manual/searching.html
Currently, I have the following setup for the YAML file to create my objects. It correctly generates my class Style object as a class.
...\Style: type: entity table: styles id: id: type: integer generator: strategy: IDENTITY actAs: Searchable: fields: [title] batchUpdates: true fields: title: type: string length: 150 unique: true
In my controller, I am trying to search in this table based on a row.
public function searchAction($pattern) { $repository = $this->getDoctrine()->getRepository('..:Style'); $search = $repository->search($pattern); return $this->outputize($search); }
However, when I try to execute the code, I get the following exception.
Undefined method 'search'. The method name must start with either findBy or findOneBy!
Am I creating my entities correctly or is there something that I clearly don't see?
On the side of the note, when I look at my Entity/Style.php after generation, there is no clear method ->search() , is the function that should be created by Symfony here?
source share