当前位置: 首页>>代码示例>>PHP>>正文


PHP Criteria::expr方法代码示例

本文整理汇总了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);
 }
开发者ID:KnpLabs,项目名称:KnpBundles,代码行数:8,代码来源:Developer.php

示例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();
     }
 }
开发者ID:bantudevelopment,项目名称:polysmis,代码行数:27,代码来源:Student.php

示例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();
     }
 }
开发者ID:bantudevelopment,项目名称:polysmis,代码行数:24,代码来源:Staff.php

示例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;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:24,代码来源:scoredisplay.class.php


注:本文中的Criteria::expr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。