
Untitled
By: a guest on
Aug 5th, 2012 | syntax:
None | size: 0.61 KB | hits: 18 | expires: Never
How to get row count with a query using Propel 1.6's Custom SQL?
$con = Propel::getConnection(VerbNounPeer::DATABASE_NAME);
$countSql = "SELECT COUNT(*) FROM ("
." SELECT DISTINCT ON (fk_noun_id) *"
." FROM verb_noun"
." ORDER BY fk_noun_id, verb_noun_vote_count DESC"
.") inner_tb";
$countSqlStmt = $con->prepare($countSql);
$countSqlStmt->execute();
$recordsCount = $countSqlStmt[0];
$countSqlFormatter = new PropelArrayFormatter();
$countSqlRow = $countSqlFormatter->format($countSqlStmt);
$formatter->setClass('VendorNameNameBundleModelVerbNoun');