<@[for i in linq.TrueIncidents -> i.RecTime, i.Name, (if i.Description = null && i.ID.HasValue = false then i.Message else "hello") ] @>
作品
<@[for i in linq.TrueIncidents -> i.RecTime, i.Name, (if i.Description = null && not <| i.ID.HasValue then i.Message e
在我的第一个大型Symfony2项目上工作时,我遇到了一些小问题,我很难理解事件侦听器/订阅者发生了什么。
我希望有一个事件订阅者在用户注册其帐户后将角色(BLOG_USER)添加到FOSUser实体。
到目前为止,我得到的是:
登记听者:
namespace MyBlog\SiteBundle\EventListener;
use FOS\UserBundle\FOSUserEvents;
use FOS\UserBundle\Event\FormEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
型号:
class Person(models.Model):
name = ....
class Registration(models.Model):
person = models.ForeignKey(person)
expires = models.DateField()
每年都有一个新的登记记录。
现在我想找出所有登记过期或从未登记的人。有点像
Person.objects.filter(registration__expires__lte=date.today() )
当然,在针对person的查询中不能使用“注册”。
是否需要将最新的注册日期存储在pers