开发者

symfony + doctrine help

I am looking for some, I have the following table setup in my test symfony site,

event  
----------  
id
title
description
date

event_signup  
--------------
id
name
event_id

From this I hope you can see that there is a relationship between event and event_signup.

I want to know how I can get the names for the people that have signed to an event, with mysql I would do something similar too,

SELECT('*') FROM event LEFT JOIN 'event_signup' ON event.id = event_signup.e开发者_Go百科vent_id

How could I write in the styl of Doctrine?


If you have defined the relationships correctly in your schema file, you would be able to first retrieve the event object you want, then just write $event->getEventSignups() to get the related objects, and call ->getName() on them to get the names.


Go here

It looks like this

JobeetAffiliate:
  actAs: { Timestampable: ~ }
  columns:
  url:       { type: string(255), notnull: true }
  email:     { type: string(255), notnull: true, unique: true }
  token:     { type: string(255), notnull: true }
  is_active: { type: boolean, notnull: true, default: 0 }
   relations:
   JobeetCategories:
    class: JobeetCategory
    refClass: JobeetCategoryAffiliate
    local: affiliate_id
    foreign: category_id
    foreignAlias: JobeetAffiliates
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜