I'm building a job portal. I'm using symfony 1.1 framework which uses Propel database 开发者_Python百科engine. I have three tables such as user, job and job_applied. user table has uid , job table has jid and job_applied has uid and jid . I need to get job title, description, position of job table according to uid and jid of job_applied table.
$c = new Criteria();
$c->addJoin(JobAppliedPeer::JID, JobPeer::JID);
$c->addJoin(JobAppliedPeer::UID, UserPeer::UID);
$c->add (whatever other criteria you need);
$apps = JobAppliedPeer::doSelect($c);
for ($apps as $app) {
$jt = $app->getJob()->getJobTitle();
}
etc.
You may need to adjust this a bit because of your column names: I always use a column name like 'job_id' for foreign keys like this, and then Propel automatically generates accessor methods 'getJob' and 'getJobId'.
精彩评论