• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Criteria类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Criteria的典型用法代码示例。如果您正苦于以下问题:PHP Criteria类的具体用法?PHP Criteria怎么用?PHP Criteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Criteria类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: executeUpdate

 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
     $this->forward404Unless($course = CoursePeer::retrieveByPk($request->getParameter('id')), sprintf('Object course does not exist (%s).', $request->getParameter('id')));
     $values = array('edit' => 'true');
     $this->form = new CourseForm($course, $values);
     $c = new Criteria();
     $c->add(CourseDetailPeer::COURSE_ID, $request->getParameter('id'));
     $courseDetail = CourseDetailPeer::doSelectOne($c);
     if ($courseDetail !== null) {
         $this->form2 = new CourseDetailForm($courseDetail);
     } else {
         $this->form2 = new CourseDetailForm(new CourseDetail());
     }
     $c2 = new Criteria();
     $c2->add(CourseDetailPeer::COURSE_ID, $request->getParameter('id'));
     $courseDisAssoc = CourseDisciplineAssociationPeer::doSelectOne($c2);
     if ($courseDisAssoc !== null) {
         $this->form3 = new CourseDisciplineAssociationForm($courseDisAssoc);
     } else {
         $this->form3 = new CourseDisciplineAssociationForm(new CourseDisciplineAssociation());
     }
     $this->submitForm($request, $this->form, $this->form2, $this->form3);
     //at this point the save has failed
     $c = new Criteria();
     //$c->addSelectColumn(CoursePeer::ID);
     $this->course_list = $this->getCourselist($c);
     $this->setTemplate('index');
 }
开发者ID:jasonkouoft,项目名称:SkuleCourses,代码行数:29,代码来源:actions.class.php


示例2: executeList

 public function executeList()
 {
     $c = new Criteria();
     $c->add(DosagePeer::STATUS, Constant::RECORD_STATUS_DELETED, Criteria::NOT_EQUAL);
     $c->addAscendingOrderByColumn(DosagePeer::TITLE);
     $this->dosages = DosagePeer::doSelect($c);
 }
开发者ID:lejacome,项目名称:hospital-mgt,代码行数:7,代码来源:actions.class.php


示例3: execute

 public function execute(&$value, &$error)
 {
     $id = $this->getContext()->getRequest()->getParameter('id');
     $name = $value;
     $c = new Criteria();
     $c->add(UserPeer::USERNAME, $name);
     $user = UserPeer::doSelectOne($c);
     $condition = true;
     if ($user) {
         if ($id && $id == $user->getId()) {
             $condition = true;
         } else {
             $error = 'User ' . $user->getUsername() . ' already Exist.';
             $condition = false;
         }
     }
     $roles = RolePeer::doSelect(new Criteria());
     $found = false;
     foreach ($roles as $role) {
         if ($this->getContext()->getRequest()->getParameter($role->getName(), 0) == 1) {
             $found = true;
         }
     }
     if (!$found) {
         $error = 'Please select atleast one role';
         $condition = false;
     }
     return $condition;
 }
开发者ID:Ayaan123,项目名称:alumnisangam,代码行数:29,代码来源:uniqueuserValidator.class.php


示例4: build

 public function build($runData)
 {
     $site = $runData->getTemp("site");
     $runData->contextAdd("site", $site);
     // select templates
     $templatesCategory = DB_CategoryPeer::instance()->selectByName("template", $site->getSiteId());
     if ($templatesCategory == null) {
         $runData->contextAdd("noTemplates", true);
         return;
     }
     $c = new Criteria();
     $c->add("category_id", $templatesCategory->getCategoryId());
     $c->addOrderAscending("title");
     $templates = DB_PagePeer::instance()->select($c);
     $runData->contextAdd("templates", $templates);
     // get all categories for the site
     $c = new Criteria();
     $c->add("site_id", $site->getSiteId());
     $c->addOrderAscending("replace(name, '_', '00000000')");
     $categories = DB_CategoryPeer::instance()->select($c);
     $runData->contextAdd("categories", $categories);
     // also prepare categories to put into javascript...
     $cats2 = array();
     foreach ($categories as $category) {
         $cats2[] = $category->getFieldValuesArray();
     }
     $runData->ajaxResponseAdd("categories", $cats2);
 }
开发者ID:jbzdak,项目名称:wikidot,代码行数:28,代码来源:ManageSiteTemplatesModule.php


示例5: configure

 public function configure()
 {
     // Sort
     $activitySortCriteria = new Criteria();
     $activitySortCriteria->addAscendingOrderByColumn(ActivityPeer::NAME);
     $userSortCriteria = new Criteria();
     $userSortCriteria->addAscendingOrderByColumn(UserPeer::FAMILY_NAME);
     // Remove some fields
     //unset($this['usergroup_has_chief_list']);
     // Labels
     $activityItem = ConfigurationHelper::getParameter('Rename', 'activity_label');
     if (is_null($activityItem) || empty($activityItem)) {
         $activityItem = 'Activities';
     }
     $this->widgetSchema->setLabel('usergroup_has_chief_list', 'Leader(s)');
     $this->widgetSchema->setLabel('usergroup_has_user_list', 'Member(s)');
     $this->widgetSchema->setLabel('usergroup_has_activity_list', $activityItem);
     // Validators
     $this->validatorSchema['name'] = new sfXSSValidatorString(array('max_length' => 64));
     // Options
     $this->widgetSchema['usergroup_has_chief_list']->setOption('expanded', true);
     $this->widgetSchema['usergroup_has_chief_list']->setOption('criteria', $userSortCriteria);
     $this->validatorSchema['usergroup_has_chief_list']->setOption('required', true);
     $this->widgetSchema['usergroup_has_user_list']->setOption('expanded', true);
     $this->widgetSchema['usergroup_has_user_list']->setOption('criteria', $userSortCriteria);
     $this->widgetSchema['usergroup_has_activity_list']->setOption('expanded', true);
     $this->widgetSchema['usergroup_has_activity_list']->setOption('criteria', $activitySortCriteria);
     $this->validatorSchema['usergroup_has_activity_list']->setOption('required', true);
 }
开发者ID:jfesquet,项目名称:tempos,代码行数:29,代码来源:UsergroupForm.class.php


示例6: saveAuthorArticleList

 public function saveAuthorArticleList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['author_article_list'])) {
         // somebody has unset this widget
         return;
     }
     if (null === $con) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(AuthorArticlePeer::AUTHOR_ID, $this->object->getPrimaryKey());
     AuthorArticlePeer::doDelete($c, $con);
     $values = $this->getValue('author_article_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new AuthorArticle();
             $obj->setAuthorId($this->object->getPrimaryKey());
             $obj->setArticleId($value);
             $obj->save();
         }
     }
 }
开发者ID:cuongnv540,项目名称:jobeet,代码行数:25,代码来源:BaseAuthorForm.class.php


示例7: executeRun

 public function executeRun()
 {
     $this->error = false;
     if (!$this->applicant) {
         $this->error = true;
         $this->messageError = 'Applicant Not Found';
         return false;
     }
     $ta = $this->applicant;
     $this->ta_detail = $ta->getTestApplicantDetail();
     if (!$this->ta_detail) {
         $this->error = true;
         $this->messageError = 'Applicant Detail Not Found';
         return false;
     }
     $cw = new Criteria();
     $cw->add(DepartmentDetailPeer::DEPARTMENT_ID, $ta->getDepartment1());
     $this->department_detail = DepartmentDetailPeer::doSelectOne($cw);
     if (!$this->department_detail) {
         $this->error = true;
         $this->messageError = 'Department not found';
         return false;
     }
     $c = new Criteria();
     $c->add(PaymentJournalPeer::PAYER, $ta->getId());
     $c->add(PaymentJournalPeer::PAYER_TYPE, PaymentJournal::PAYER_TYPE_APPLICANT);
     $payments = PaymentJournalPeer::doSelect($c);
     if (!$payments) {
         $this->error = true;
         $this->messageError = 'Payments not fond';
         return false;
     }
     $this->payments = $payments;
 }
开发者ID:taryono,项目名称:school,代码行数:34,代码来源:components.class.php


示例8: getAsistencia

 public static function getAsistencia($evaluacion, $aspirante)
 {
     $criteria = new Criteria();
     $criteria->add(AsistenciasPeer::EVALUACIONES_ID, $evaluacion, Criteria::EQUAL);
     $criteria->add(AsistenciasPeer::ASPIRANTES_ID, $aspirante, Criteria::EQUAL);
     return self::doSelectOne($criteria);
 }
开发者ID:qwerfaqs,项目名称:psicotest,代码行数:7,代码来源:AsistenciasPeer.php


示例9: saveUsuarioRolList

 public function saveUsuarioRolList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['usuario_rol_list'])) {
         // somebody has unset this widget
         return;
     }
     if (is_null($con)) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(UsuarioRolPeer::FK_ROL_ID, $this->object->getPrimaryKey());
     UsuarioRolPeer::doDelete($c, $con);
     $values = $this->getValue('usuario_rol_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new UsuarioRol();
             $obj->setFkRolId($this->object->getPrimaryKey());
             $obj->setFkUsuarioId($value);
             $obj->save();
         }
     }
 }
开发者ID:mediasadc,项目名称:alba,代码行数:25,代码来源:BaseRolForm.class.php


示例10: getAllCommentsForResource

 public static function getAllCommentsForResource($resource, $con = null)
 {
     $c = new Criteria();
     $c->add(sfEmendCommentPeer::URL, $resource);
     $c->add(sfEmendCommentPeer::IS_PUBLIC, 1);
     return sfEmendCommentPeer::doSelect($c, $con);
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:7,代码来源:sfEmendCommentPeer.php


示例11: saveProductHasColorList

 public function saveProductHasColorList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['product_has_color_list'])) {
         // somebody has unset this widget
         return;
     }
     if (null === $con) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(ProductHasColorPeer::COLOR_ID, $this->object->getPrimaryKey());
     ProductHasColorPeer::doDelete($c, $con);
     $values = $this->getValue('product_has_color_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new ProductHasColor();
             $obj->setColorId($this->object->getPrimaryKey());
             $obj->setProductId($value);
             $obj->save();
         }
     }
 }
开发者ID:alexspark21,项目名称:symfony_bisM,代码行数:25,代码来源:BaseColorForm.class.php


示例12: doSaveMedia

 public function doSaveMedia($v)
 {
     if ($v == null) {
         $image = $this->getImagePath();
         if ($this->isNew) {
             $content = file_get_contents(sfConfig::get('sf_root_dir') . '/public_html' . $image);
             $size = getimagesize(sfConfig::get('sf_root_dir') . '/public_html' . $image);
         } else {
             return $this->getObject()->getImagesId();
         }
     } else {
         $content = file_get_contents($v->getTempName());
         $size = getimagesize($v->getTempName());
     }
     $hash = md5($content);
     $criteria = new Criteria();
     $criteria->add(ImagesPeer::CONTENT_HASH, $hash);
     $obj = ImagesPeer::doSelectOne($criteria);
     try {
         if (empty($obj)) {
             $obj = new Images();
             $obj->setNameDownloadedFile($v->getOriginalName())->setNameFileForPage($v->getOriginalName())->setTypeImg($v->getType())->setHeight($size[2])->setWidth($size[1])->setContentHash($hash . '.jpg')->setContent(base64_encode($content))->setCreatedAt(date("Y-m-d H:i"))->setUpdatedAt(date("Y-m-d H:i"))->save();
         }
     } catch (Exception $e) {
         echo "stdfdfdfdfrt";
         die;
     }
     $criteria = new Criteria();
     $criteria->add(ImagesPeer::CONTENT_HASH, $obj->getContentHash());
     $obj = ImagesPeer::doSelectOne($criteria);
     return $obj->getId();
 }
开发者ID:alexspark21,项目名称:symfony_bisM,代码行数:32,代码来源:ColorForm.class.php


示例13: saveJobeetCategoryAffiliateList

 public function saveJobeetCategoryAffiliateList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['jobeet_category_affiliate_list'])) {
         // somebody has unset this widget
         return;
     }
     if (null === $con) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(JobeetCategoryAffiliatePeer::CATEGORY_ID, $this->object->getPrimaryKey());
     JobeetCategoryAffiliatePeer::doDelete($c, $con);
     $values = $this->getValue('jobeet_category_affiliate_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new JobeetCategoryAffiliate();
             $obj->setCategoryId($this->object->getPrimaryKey());
             $obj->setAffiliateId($value);
             $obj->save();
         }
     }
 }
开发者ID:hira-yahoo,项目名称:Jobeet4,代码行数:25,代码来源:BaseJobeetCategoryForm.class.php


示例14: getallByClassRoom

 public static function getallByClassRoom($classroom_id)
 {
     $c = new Criteria();
     $c->addJoin(ClassroomResourcesPeer::RESOURCE_ID, self::ID);
     $c->add(ClassroomResourcesPeer::CLASSROOM_ID, $classroom_id);
     return self::doSelect($c);
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:7,代码来源:ResourcesPeer.php


示例15: getByURI

 /**
  * Get repository by URI
  * @param string $url the url of the repository to find
  * @return QubitQuery collection of OAI-PMH Repositories
  */
 public static function getByURI($URI)
 {
     $criteria = new Criteria();
     $criteria->add(QubitOaiRepository::URI, $URI, Criteria::LIKE);
     $criteria->addAscendingOrderByColumn(QubitOaiRepository::NAME);
     return self::get($criteria);
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:12,代码来源:QubitOaiRepository.php


示例16: testStaticDoSoftDelete

 public function testStaticDoSoftDelete()
 {
     $t1 = new Table4();
     $t1->save();
     $t2 = new Table4();
     $t2->save();
     $t3 = new Table4();
     $t3->save();
     // softDelete with a criteria
     $c = new Criteria();
     $c->add(Table4Peer::ID, $t1->getId());
     Table4Peer::doSoftDelete($c);
     Table4Peer::disableSoftDelete();
     $this->assertEquals(3, Table4Peer::doCount(new Criteria()), 'doSoftDelete() keeps deleted record in the database');
     Table4Peer::enableSoftDelete();
     $this->assertEquals(2, Table4Peer::doCount(new Criteria()), 'doSoftDelete() marks deleted record as deleted');
     // softDelete with a value
     Table4Peer::doSoftDelete(array($t2->getId()));
     Table4Peer::disableSoftDelete();
     $this->assertEquals(3, Table4Peer::doCount(new Criteria()), 'doSoftDelete() keeps deleted record in the database');
     Table4Peer::enableSoftDelete();
     $this->assertEquals(1, Table4Peer::doCount(new Criteria()), 'doSoftDelete() marks deleted record as deleted');
     // softDelete with an object
     Table4Peer::doSoftDelete($t3);
     Table4Peer::disableSoftDelete();
     $this->assertEquals(3, Table4Peer::doCount(new Criteria()), 'doSoftDelete() keeps deleted record in the database');
     Table4Peer::enableSoftDelete();
     $this->assertEquals(0, Table4Peer::doCount(new Criteria()), 'doSoftDelete() marks deleted record as deleted');
 }
开发者ID:nextbigsound,项目名称:propel-orm,代码行数:29,代码来源:SoftDeleteBehaviorTest.php


示例17: executeDelete

 public function executeDelete()
 {
     $userId = sfContext::getInstance()->getUser()->getAttribute('subscriber_id', null, 'subscriber');
     $this->bikeid = $this->getRequestParameter('bikeid');
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         //delete user_stat and equipment
         $c = new Criteria();
         $c->add(UserStatsPeer::USER_ID, $userId);
         $c->add(UserStatsPeer::BIKE_ID, $this->bikeid);
         $s = UserStatsPeer::doSelectJoinAll($c);
         foreach ($s as $stat) {
             foreach ($stat->getUserStatEquips() as $equip) {
                 $equip->delete();
             }
             $stat->delete();
         }
         //move equipment to shelf
         $c = new Criteria();
         $c->add(UserEquipementPeer::USER_ID, $userId);
         $c->add(UserEquipementPeer::BIKE_ID, $this->bikeid);
         $equip = UserEquipementPeer::doSelect($c);
         foreach ($equip as $e) {
             $e->setBikeId(null);
             $e->save();
         }
         //now delete bike
         $user_bikes = UserBikesPeer::retrieveByPk($this->bikeid);
         $user_bikes->delete();
         return $this->redirect('userbike/index');
     }
 }
开发者ID:broschb,项目名称:cyclebrain,代码行数:31,代码来源:actions.class.php


示例18: cleanup

 public static function cleanup($days)
 {
     $criteria = new Criteria();
     $criteria->add(self::IS_ACTIVATED, false);
     $criteria->add(self::CREATED_AT, time() - 86400 * $days, Criteria::LESS_THAN);
     return self::doDelete($criteria);
 }
开发者ID:hira-yahoo,项目名称:Jobeet4,代码行数:7,代码来源:JobeetJobPeer.php


示例19: getByKuserAndUserRoleIds

 /**
  * Get objects by kuser and user role IDs
  * @param int $kuserId
  * @param int $userRoleId
  * @return array Array of selected KuserToUserRole Objects
  */
 public static function getByKuserAndUserRoleIds($kuserId, $userRoleId)
 {
     $c = new Criteria();
     $c->addAnd(self::KUSER_ID, $kuserId, Criteria::EQUAL);
     $c->addAnd(self::USER_ROLE_ID, $userRoleId, Criteria::EQUAL);
     return self::doSelect($c);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:13,代码来源:KuserToUserRolePeer.php


示例20: updateAction

 public function updateAction()
 {
     $criteria = new Criteria("person");
     $person = PersonData::getById($_POST["id"]);
     $criteria->update(array("no" => "\"{$_POST['no']}\"", "name" => "\"{$_POST['name']}\"", "lastname" => "\"{$_POST['lastname']}\"", "job" => "\"{$_POST['job']}\"", "phone1" => "\"{$_POST['phone1']}\"", "phone2" => "\"{$_POST['phone2']}\"", "address1" => "\"{$_POST['address1']}\"", "address2" => "\"{$_POST['address2']}\"", "email1" => "\"{$_POST['email1']}\"", "email2" => "\"{$_POST['email2']}\"", "team_id" => "\"{$_POST['team_id']}\"", "category_id" => "\"{$_POST['category_id']}\""), "id=" . $_POST["id"]);
     Core::redir("./?r=index/people");
 }
开发者ID:CloudGt,项目名称:suggbox-php,代码行数:7,代码来源:PersonController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CriteriaCompo类代码示例发布时间:2022-05-23
下一篇:
PHP Creole类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap