Kohana 3 ORM find_all() returns all rows regardless of where clause -


I have a simple user table, and I want to find all the users where Email_notifications = 1

The argument determines that the following should be done:

  class controller_cost controller {public function action_index () {$ User = ORM: : Factory ('user'); $ User = $ user- & gt; Where ('email_notification', '=', 1); $ Total = $ user- & gt; Counts_all (); $ User = $ user- & gt; Search_fill (); Copy $ total. "Get the record."; Br / & gt; "; Forex Currency ($ V as $ user) {echo $ v- & gt; Id; Echo $ v- & gt; first name; Echo $ v- & gt; Last_name; Counterpart $ v- & gt; E-mail; }}}   


However, what is happening is that I am getting back all the users from DB, not just with the email-annotation is on the funny thing This is that the value returned $ total is the result of the exact number of this query.

I am so stumped, I do not know what the problem is here, here. If someone can be given some light, I would appreciate it.

Thank you, Brian

calling count_all () < / Code> will reset your model conditions. To avoid this, try using reset (FALSE) :

  $ user = ORM :: factory ('user'); $ User = $ user- & gt; Where ('email_notification', '=', 1); $ User- & gt; Reset (FALSE); $ Total = $ user- & gt; Counts_all (); $ User = $ user- & gt; Search_fill ();    

Comments