How do i use findAll method with a class in Doctrine?
12,510
Solution 1
AFAIK User object represents a single row in a table.if you need all the users you need to ask the table.
Solution 2
For Doctrine 2, you need to get the repository:
$AllUsers = EM()->getRepository('Users')->findAll();
Author by
Moon
Updated on June 04, 2022Comments
-
Moon almost 2 years
I am a little bit confused with Doctrine class. I created a class and its base class in Doctrine. The class's name is User.
so..I created an object of class User.
$oUser = new User();
when I try to use the
findAll
method, it does not work. I found the following code on the doctrine documentation:Doctrine_Core::getTable('User')->findAll();
I don't understand why i need to call
getTable
to use thefindAll
method when I have User class.Am I missing something?