Skip to content

Instantly share code, notes, and snippets.

@slave2zeros
Created November 27, 2012 22:37
Show Gist options
  • Save slave2zeros/4157656 to your computer and use it in GitHub Desktop.
Save slave2zeros/4157656 to your computer and use it in GitHub Desktop.
mysql> select * from tours;
+----+------------------+-------------+------------------+---------------------+
| id | tour_name | eg_env | kera_tutorial_id | created_at |
+----+------------------+-------------+------------------+---------------------+
| 2 | Team site signup | development | 650a40430f | 2012-11-26 17:01:39 |
| 3 | Team site signup | staging | b283456766 | 2012-11-26 17:01:39 |
| 4 | Team site signup | production | 94af058d3a | 2012-11-26 17:01:39 |
+----+------------------+-------------+------------------+---------------------+
3 rows in set (0.00 sec)
mysql> describe tours_users
-> ;
+--------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+----------------+
| id | int(11) unsigned | NO | PRI | NULL | auto_increment |
| tour_id | int(11) unsigned | YES | MUL | NULL | |
| user_id | int(11) unsigned | YES | MUL | NULL | |
| started_at | timestamp | YES | | NULL | |
| completed_at | timestamp | YES | | NULL | |
+--------------+------------------+------+-----+---------+----------------+
5 rows in set (0.01 sec)
$q = Doctrine_Query::create()
->from('TourUser as tu')
->leftJoin("tu.Tour t ON tu.tour_id = t.id")
->where('t.tour_name = ', $name)
->where('t.eg_env = ?', EG_ENV);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment