How to make "Select an account ..." using symfony and propel?

I am trying to make a very simple sql query like this for the propel criterion:

SELECT count(id_user) FROM myTable WHERE id_page = 5

I did not find any documentation information.

Do you have an idea?

+3
source share
2 answers
$c = new Criteria();
$c->add(myTablePeer::ID_PAGE,5);
$count = myTablePeer::doCount($c);
+4
source

If you want to issue SELECT COUNT (*) based on the current ModelCriteria, you can also do

$yourCriteria->count();

This will return you the number of results.

+2
source

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


All Articles