本文整理汇总了PHP中Criteria::expr方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::expr方法的具体用法?PHP Criteria::expr怎么用?PHP Criteria::expr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criteria
的用法示例。
在下文中一共展示了Criteria::expr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLatestActivities
public function getLatestActivities($type = Activity::ACTIVITY_TYPE_COMMIT)
{
if (!in_array($type, array(Activity::ACTIVITY_TYPE_COMMIT, Activity::ACTIVITY_TYPE_RECOMMEND))) {
throw new \InvalidArgumentException();
}
$criteria = Criteria::create()->where(Criteria::expr()->eq('type', $type))->orderBy(array("createdAt" => "DESC"))->setFirstResult(0)->setMaxResults(30);
return $this->activities->matching($criteria);
}
示例2: saveEmployment
public function saveEmployment($studentobject)
{
if (!$studentobject->getPkEmploymentid()) {
$student = new \Application\Entity\Employment();
} else {
$criteria = Criteria::create()->where(Criteria::expr()->eq("pkEmploymentid", $studentobject->getPkEmploymentid()));
$student = $this->getEntity("\\Application\\Entity\\Employment", $criteria);
}
//Set user object values to be saved
$student->setFkStudentid($studentobject->getFkStudentid());
$student->setDesignation($studentobject->getDesignation());
$student->setOrganization($studentobject->getOrganization());
$student->setEndYear($studentobject->getEndYear());
$student->setStartYear($studentobject->getStartYear());
$student->setIsCurrent($studentobject->getIsCurrent());
try {
//Commit values set to the object
if (!$studentobject->getPkEmploymentid()) {
$this->em->persist($student);
}
//Save values if just updating record
$this->em->flush($student);
return $student;
} catch (Doctrine\ORM\ORMException $e) {
throw $e->getMessage();
}
}
示例3: allocate
public function allocate($object)
{
if (!$object->getPkStaffid()) {
$staff = new \Application\Entity\Staff();
} else {
$criteria = Criteria::create()->where(Criteria::expr()->eq("pkStaffid", $object->getPkStaffid()));
$staff = $this->getEntity("\\Application\\Entity\\Staff", $criteria);
}
//Set user object values to be saved
$staff->setFkUserid($object->getFkUserid());
$staff->setFkDeptid($object->getFkDeptid());
$staff->setMode($object->getMode());
try {
//Commit values set to the object
if (!$object->getPkStaffid()) {
$this->em->persist($staff);
}
//Save values if just updating record
$this->em->flush($staff);
return $staff;
} catch (Exception $e) {
throw $e->getMessages();
}
}
示例4: get_current_gradebook_category_id
/**
* Get current gradebook category id
* @return int Category id
*/
private function get_current_gradebook_category_id()
{
$curr_course_id = api_get_course_int_id();
$curr_session_id = api_get_session_id();
$em = Database::getManager();
$qb = $em->createQueryBuilder();
$qb->select('gc')->from('ChamiloCoreBundle:GradebookCategory')->where(Criteria::expr()->eq('course', $curr_course_id));
if (empty($curr_session_id)) {
$qb->andWhere($qb->expr()->isNull('sessionId'));
} else {
$qb->andWhere($qb->expr()->eq('sessionId', $curr_session_id));
}
$rs = $qb->getQuery()->getResult();
$category_id = 0;
if (count($rs) > 0) {
$row = current($rs);
$category_id = $row->getId();
}
return $category_id;
}