开发者

How do i use findAll method with a class in Doctrine?

开发者 https://www.devze.com 2022-12-24 09:08 出处:网络
I am a little bit confused with Doctrine class. I created a class an开发者_开发百科d its base class in Doctrine. The class\'s name is User.

I am a little bit confused with Doctrine class. I created a class an开发者_开发百科d 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 the findAll method when I have User class.

Am I missing something?


For Doctrine 2, you need to get the repository:

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


AFAIK User object represents a single row in a table.if you need all the users you need to ask the table.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号