How to use findAll method with class in Doctrine?

I am a little confused by the Doctrine class. I created a class and its base class in Doctrine. Class Name - User.

so..I created an object of class User.

$oUser = new User();

when I try to use the method findAll, it does not work. I found the following code in the doctrine documentation:

Doctrine_Core::getTable('User')->findAll();

I do not understand why I need to call getTableto use the method findAllwhen I have a user class.

Did I miss something?

+3
source share
2 answers

AFAIK A custom object is a single row in a table. If you need all the users you should ask in the table.

+6
source

Doctrine 2 :

$AllUsers = EM()->getRepository('Users')->findAll();
+12

Source: https://habr.com/ru/post/1737885/


All Articles