This question may be unrelated to symfony, and more related to
database abstraction, but I'm wondering why I should pull the table
names from the model.  I've been programming for a long time and have
never seen anyone need to use dyamic table names except when they have
prefixes on them that can change.

So, this is a pain to type out:

public static function getUserLabelsWithPasswordCounts($userId) {
    $query = "SELECT
                " . PasswordLabelPeer::NAME . ",
                (SELECT COUNT(*) FROM " .
PasswordLabelPasswordsPeer::TABLE_NAME . " WHERE " .
PasswordLabelPasswordsPeer::LABEL_ID . " = " . PasswordLabelPeer::ID .
") AS pcount
              FROM
                " . PasswordLabelPeer::TABLE_NAME . "
              WHERE
                " . PasswordLabelPeer::ID . " = '$userId'
              ORDER BY
                " . PasswordLabelPeer::NAME . " ASC";

    $con = Propel::getConnection();
    $pdo = $con->prepare($query);
    $pdo->execute();

    return $pdo->fetchAll(PDO::FETCH_OBJ);
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to