本文整理汇总了PHP中unknown::hasIdentity方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown::hasIdentity方法的具体用法?PHP unknown::hasIdentity怎么用?PHP unknown::hasIdentity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown
的用法示例。
在下文中一共展示了unknown::hasIdentity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllEvents
/**
* Get all events intersecting [$start, $end] and affected to the user's organisation
*
* @param unknown $user
* @param unknown $start
* DateTime
* @param unknown $end
* DateTime
* @param unknown $exclude
* @param array $status
*/
public function getAllEvents($user, $start, $end, $exclude = false, $status = null)
{
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select(array('e, c'))->from('Application\\Entity\\Event', 'e')->innerJoin('e.category', 'c')->andWhere($qb->expr()->isNull('e.parent'))->andWhere($qb->expr()->orX($qb->expr()->andX($qb->expr()->isNull('e.enddate'), $qb->expr()->eq('e.punctual', 'false'), $qb->expr()->lte('e.startdate', '?2')), $qb->expr()->andX($qb->expr()->isNotNull('e.enddate'), $qb->expr()->eq('e.punctual', 'false'), $qb->expr()->lte('e.startdate', '?2'), $qb->expr()->gte('e.enddate', '?1')), $qb->expr()->andX($qb->expr()->eq('e.punctual', 'true'), $qb->expr()->gte('e.startdate', '?1'), $qb->expr()->lte('e.startdate', '?2'))));
//restriction sur le statut
if ($status) {
$qb->andWhere($qb->expr()->in('e.status', $status));
}
//exclusion des catégories pour rapport IPO
if ($exclude) {
$qb->andWhere($qb->expr()->eq('c.exclude', '?3'));
$parameters[3] = false;
}
if ($user !== null && $user->hasIdentity()) {
$org = $user->getIdentity()->getOrganisation();
$qb->andWhere($qb->expr()->eq('e.organisation', $org->getId()));
$parameters[1] = $start->format("Y-m-d H:i:s");
$parameters[2] = $end->format("Y-m-d H:i:s");
$qb->setParameters($parameters);
$query = $qb->getQuery();
return $query->getResult();
} else {
return array();
}
}
示例2: getAllEvents
/**
* Get all events intersecting [$start, $end] and affected to the user's organisation
*
* @param unknown $user
* @param unknown $start
* DateTime
* @param unknown $end
* DateTime
*/
public function getAllEvents($user, $start, $end)
{
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select(array('e'))->from('Application\\Entity\\Event', 'e')->andWhere($qb->expr()->isNull('e.parent'))->andWhere($qb->expr()->orX($qb->expr()->andX($qb->expr()->isNull('e.enddate'), $qb->expr()->eq('e.punctual', 'false'), $qb->expr()->lte('e.startdate', '?2')), $qb->expr()->andX($qb->expr()->isNotNull('e.enddate'), $qb->expr()->eq('e.punctual', 'false'), $qb->expr()->lte('e.startdate', '?2'), $qb->expr()->gte('e.enddate', '?1')), $qb->expr()->andX($qb->expr()->eq('e.punctual', 'true'), $qb->expr()->gte('e.startdate', '?1'), $qb->expr()->lte('e.startdate', '?2'))));
if ($user !== null && $user->hasIdentity()) {
$org = $user->getIdentity()->getOrganisation();
$qb->andWhere($qb->expr()->eq('e.organisation', $org->getId()));
$parameters[1] = $start->format("Y-m-d H:i:s");
$parameters[2] = $end->format("Y-m-d H:i:s");
$qb->setParameters($parameters);
$query = $qb->getQuery();
return $query->getResult();
} else {
return array();
}
}