Created
March 14, 2018 23:19
-
-
Save DavidMellul/7f2907e769367c243f7769455b5d7e6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Could have broken request clauses line by line | |
| // SELECT X FROM Y WHERE Z | |
| // -> | |
| // SELECT X | |
| // FROM Y | |
| // WHERE Z | |
| final class RequestHolder { | |
| // Query a list of users without ordering | |
| const USERS = 'SELECT * FROM USERS'; | |
| // Query all the messages of a user identified by @id_user, ordered by sending date | |
| const USER_MESSAGES = 'SELECT * FROM Messages WHERE id_user = ? ORDER BY date_sent'; | |
| // And so on | |
| // ... | |
| private function __construct(){ | |
| // Stuff | |
| } | |
| } | |
| $this->db->query(RequestHolder.USERS); | |
| $this->db->query(RequestHolder.USER_MESSAGES, array('id_user' => 58)); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment