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


PHP Criteria::add方法代码示例

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


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

示例1: execute

 public function execute(&$value, &$error)
 {
     $class_name = $this->getParameter('class_name');
     $field_const_name = $this->getParameter('field_const_name');
     $form_field_name = $this->getParameter('form_field_name');
     $form_field_value = $this->getContext()->getRequest()->getParameter($form_field_name);
     $form_id_name = $this->getParameter('form_id_name');
     if ($form_id_name) {
         $form_id_value = $this->getContext()->getRequest()->getParameter($form_id_name);
     }
     $class = new ReflectionClass($class_name);
     if ($class->hasConstant($field_const_name)) {
         $criteria = new Criteria();
         $criteria->add($class->getConstant($field_const_name), $form_field_value);
         if (isset($form_id_value) && $form_id_value && $class->hasConstant('ID')) {
             $criteria->add($class->getConstant('ID'), $form_id_value, Criteria::NOT_EQUAL);
         }
         if ($class->hasMethod('doSelectOne')) {
             $ref_method = $class->getMethod('doSelectOne');
             $object = $ref_method->invoke(null, $criteria);
             if (!$object) {
                 return true;
             }
         }
         sfContext::getInstance()->getLogger()->info('Buraya geldi');
     }
     $error = $this->getParameter('unique_error');
     return false;
 }
开发者ID:hoydaa,项目名称:snippets.hoydaa.org,代码行数:29,代码来源:myUniqueValidator.class.php

示例2: 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

示例3: executeIndex

 public function executeIndex()
 {
     //perlu di rapihkan
     $field_name = $this->name;
     $reflection = new ReflectionClass($this->model . 'Peer');
     $method = $reflection->getMethod('doSelect');
     $c = new Criteria();
     $filter_field = strtoupper($this->filter_field);
     $filter_content = $this->filter_content;
     if (!empty($filter_field)) {
         if ($this->case == 'equal') {
             $c->add($reflection->getConstant($filter_field), $filter_content, Criteria::EQUAL);
         } else {
             if ($this->case == 'not_equal') {
                 $c->add($reflection->getConstant($filter_field), $filter_content, Criteria::NOT_EQUAL);
             }
         }
     }
     $order_column = $this->order_column;
     $order_type = $this->order_type;
     if (!empty($order_column)) {
         if ($order_type == 'desc') {
             $c->addDescendingOrderByColumn($order_column);
         } else {
             $c->addAscendingOrderByColumn($order_column);
         }
     }
     $reg_info = $method->invoke($method, $c);
     $this->data = $reg_info;
     $this->name = $field_name;
     $this->desc = !isset($this->desc) ? 'Name' : $this->desc;
 }
开发者ID:taryono,项目名称:school,代码行数:32,代码来源:components.class.php

示例4: retrieveByEntryAndProfileId

 /**
  * Retrieve single EntryDistribution object by entry id and profile id.
  *
  * @param      string $entryId
  * @param      int $distributionProfileId
  * @param      PropelPDO $con the connection to use
  * @return     EntryDistribution
  */
 public static function retrieveByEntryAndProfileId($entryId, $distributionProfileId, PropelPDO $con = null)
 {
     $criteria = new Criteria();
     $criteria->add(EntryDistributionPeer::ENTRY_ID, $entryId);
     $criteria->add(EntryDistributionPeer::DISTRIBUTION_PROFILE_ID, $distributionProfileId);
     return EntryDistributionPeer::doSelectOne($criteria, $con);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:15,代码来源:EntryDistributionPeer.php

示例5: loadItems

 protected function loadItems()
 {
     $c = new Criteria();
     $c->add("returnBond", "", "!=");
     $c->add('status', 'validated');
     $this->items = $this->site->findAll($c, "siteId, url, returnBond");
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:7,代码来源:SiteBacklinkBackgroundTask.php

示例6: addPermission

function addPermission($permissionCfg)
{
    // verify obligatory fields
    if (!$permissionCfg->name) {
        throw new Exception('Permission name must be set');
    }
    if ((is_null($permissionCfg->partnerId) || $permissionCfg->partnerId === '') && (is_null($permissionCfg->partnerPackages) || $permissionCfg->partnerPackages === '')) {
        throw new Exception('Permission partner id or partner package must be set');
    }
    if (isset($permissionCfg->partnerId) && $permissionCfg->partnerId != '') {
        $partnerIds = explode(",", $permissionCfg->partnerId);
        foreach ($partnerIds as $partnerId) {
            addPermissionToPartner($permissionCfg, $partnerId);
        }
    }
    if (isset($permissionCfg->partnerPackages) && $permissionCfg->partnerPackages != '') {
        $countLimitEachLoop = 100;
        $offset = $countLimitEachLoop;
        $c = new Criteria();
        $c->add(PartnerPeer::ID, 0, Criteria::GREATER_THAN);
        $c->add(PartnerPeer::PARTNER_PACKAGE, explode(',', $permissionCfg->partnerPackages), Criteria::IN);
        $c->setLimit($countLimitEachLoop);
        $partners = PartnerPeer::doSelect($c);
        while (count($partners)) {
            foreach ($partners as $partner) {
                addPermissionToPartner($permissionCfg, $partner->getId());
            }
            $c->setOffset($offset);
            PartnerPeer::clearInstancePool();
            $partners = PartnerPeer::doSelect($c);
            $offset += $countLimitEachLoop;
            sleep(1);
        }
    }
}
开发者ID:DBezemer,项目名称:server,代码行数:35,代码来源:addPermissionsAndItems.php

示例7: 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

示例8: executeIndex

 public function executeIndex(sfWebRequest $request)
 {
     //get request parameters
     $this->selectedBrand = $this->getRequestParameter('brand');
     $this->selectedSeries = $this->getRequestParameter('series');
     $this->selectedModel = $this->getRequestParameter('model');
     $cConfig = new Criteria();
     $cConfig->addJoin(ConfigPeer::MODEL_ID, ModelPeer::ID);
     $cConfig->addJoin(ModelPeer::SERIES_ID, SeriesPeer::ID);
     $cConfig->addJoin(SeriesPeer::BRAND_ID, BrandPeer::ID);
     if ($this->selectedBrand) {
         $cConfig->add(BrandPeer::ID, $this->selectedBrand);
     }
     if ($this->selectedSeries) {
         $cConfig->add(SeriesPeer::SERIES_NAME, $this->selectedSeries, Criteria::LIKE);
     }
     if ($this->selectedModel) {
         $cConfig->add(ModelPeer::MODEL_NAME, $this->selectedModel, Criteria::LIKE);
     }
     //$this->Configs = ConfigPeer::doSelect($cConfig);
     //paginatiom
     $pager = new sfPropelPager('Config', 15);
     $pager->setCriteria($cConfig);
     $pager->setPage($this->getRequestParameter('page'));
     $pager->init();
     $this->pager = $pager;
     //get config columns
     $c = new Criteria();
     $c->addDescendingOrderByColumn(ConfigFieldCategoryPeer::WEIGHT);
     $this->configFieldCategories = ConfigFieldCategoryPeer::doSelect($c);
     //get brands
     $cBrand = new Criteria();
     $this->brands = BrandPeer::doSelect($cBrand);
 }
开发者ID:navid045,项目名称:maxlaptop,代码行数:34,代码来源:actions.class.php

示例9: loadConfiguration

    public function loadConfiguration($params)
    {
        if ($params['type'] != 'activity' 
            || !\PMLicensedFeatures
                ::getSingleton()
                ->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0='))
        {
            return false;
        }
        require_once 'classes/model/AbeConfiguration.php';

        $criteria = new \Criteria();
        $criteria->add(\AbeConfigurationPeer::PRO_UID, $params['PRO_UID']);
        $criteria->add(\AbeConfigurationPeer::TAS_UID, $params['TAS_UID']);
        $result = \AbeConfigurationPeer::doSelectRS($criteria);
        $result->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
        $result->next();
        $configuration = array();
        if ($configuration = $result->getRow()) {
            $configuration['ABE_UID'] = $configuration['ABE_UID'];
            $configuration['ABE_TYPE'] = $configuration['ABE_TYPE'];
            $configuration['DYN_UID'] = $configuration['DYN_UID'];
            $configuration['ABE_TEMPLATE'] = $configuration['ABE_TEMPLATE'];
            $configuration['ABE_SUBJECT_FIELD'] = $configuration['ABE_SUBJECT_FIELD'];
            $configuration['ABE_EMAIL_FIELD'] = $configuration['ABE_EMAIL_FIELD'];
            $configuration['ABE_ACTION_FIELD'] = $configuration['ABE_ACTION_FIELD'];
            $configuration['ABE_CASE_NOTE_IN_RESPONSE'] = $configuration['ABE_CASE_NOTE_IN_RESPONSE'] ? '["1"]' : '[]';
        }
        $configuration['feature'] = 'ActionsByEmail';
        $configuration['prefix'] = 'abe';
        $configuration['PRO_UID'] = $params['PRO_UID'];
        $configuration['TAS_UID'] = $params['TAS_UID'];
        $configuration['SYS_LANG'] = SYS_LANG;
        return $configuration;
    }
开发者ID:rrsc,项目名称:processmaker,代码行数:35,代码来源:ActionsByEmail.php

示例10: selectByName

 public function selectByName($siteId, $name)
 {
     $c = new Criteria();
     $c->add("site_id", $siteId);
     $c->add("unix_name", WDStringUtils::toUnixName($name));
     return $this->selectOne($c);
 }
开发者ID:jbzdak,项目名称:wikidot,代码行数:7,代码来源:DB_PagePeer.php

示例11: build

 public function build($runData)
 {
     $userId = $runData->getUserId();
     $pl = $runData->getParameterList();
     $messageId = $pl->getParameterValue("message_id");
     $message = DB_PrivateMessagePeer::instance()->selectByPrimaryKey($messageId);
     if ($message->getFromUserId() != $userId) {
         throw new ProcessException(_("Error selecting message."), "no_message");
     }
     $runData->contextAdd("message", $message);
     // get next & previous message
     $messageId = $message->getMessageId();
     $c = new Criteria();
     $c->add("from_user_id", $userId);
     $c->add("message_id", $messageId, ">");
     $c->add("flag", 1);
     $c->addOrderAscending("message_id");
     $newerMessage = DB_PrivateMessagePeer::instance()->selectOne($c);
     $c = new Criteria();
     $c->add("from_user_id", $userId);
     $c->add("message_id", $messageId, "<");
     $c->add("flag", 1);
     $c->addOrderDescending("message_id");
     $olderMessage = DB_PrivateMessagePeer::instance()->selectOne($c);
     $runData->contextAdd("newerMessage", $newerMessage);
     $runData->contextAdd("olderMessage", $olderMessage);
 }
开发者ID:jbzdak,项目名称:wikidot,代码行数:27,代码来源:PMSentMessageModule.php

示例12: doCountByCourseSubjectAndStudent

 public static function doCountByCourseSubjectAndStudent($course_subject, $student)
 {
     $c = new Criteria();
     $c->add(self::COURSE_SUBJECT_ID, $course_subject->getId());
     $c->add(self::STUDENT_ID, $student->getId());
     return self::doCount($c);
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:7,代码来源:StudentAttendancePeer.php

示例13: execute

 public function execute($request)
 {
     $this->resource = $request->getAttribute('sf_route')->resource;
     $criteria = new Criteria();
     $criteria->add(QubitEvent::ACTOR_ID, $this->resource->id);
     $criteria->addJoin(QubitEvent::INFORMATION_OBJECT_ID, QubitInformationObject::ID);
     $criteria->addAscendingOrderByColumn(QubitEvent::TYPE_ID);
     // Sort info objects alphabetically (w/ fallback)
     $criteria->addAscendingOrderByColumn('title');
     $criteria = QubitCultureFallback::addFallbackCriteria($criteria, 'QubitInformationObject');
     // Filter draft descriptions
     $criteria = QubitAcl::addFilterDraftsCriteria($criteria);
     $this->relatedInfoObjects = array();
     foreach (QubitEvent::get($criteria) as $item) {
         $this->relatedInfoObjects[$item->type->getRole()][] = $item->informationObject;
     }
     // Get "subject of" information objects (name access point)
     $criteria = new Criteria();
     $criteria->add(QubitRelation::OBJECT_ID, $this->resource->id);
     $criteria->add(QubitRelation::TYPE_ID, QubitTerm::NAME_ACCESS_POINT_ID);
     $this->subjectInfoObjects = array();
     foreach (QubitRelation::get($criteria) as $item) {
         $this->subjectInfoObjects[] = $item->subject;
     }
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:25,代码来源:contextMenuComponent.class.php

示例14: execute

 public function execute($request)
 {
     parent::execute($request);
     // Always include root actor permissions
     $this->actors = array(QubitActor::ROOT_ID => null);
     // Get actor permissions for this resource
     $criteria = new Criteria();
     $criteria->addJoin(QubitAclPermission::OBJECT_ID, QubitObject::ID, Criteria::LEFT_JOIN);
     $criteria->add(QubitAclPermission::GROUP_ID, $this->resource->id);
     $c1 = $criteria->getNewCriterion(QubitAclPermission::OBJECT_ID, null, Criteria::ISNULL);
     $c2 = $criteria->getNewCriterion(QubitObject::CLASS_NAME, 'QubitActor');
     $c1->addOr($c2);
     $criteria->add($c1);
     if (null !== ($permissions = QubitAclPermission::get($criteria))) {
         foreach ($permissions as $p) {
             $this->actors[$p->objectId][$p->action] = $p;
         }
     }
     // List of actions without translate
     $this->basicActions = QubitAcl::$ACTIONS;
     unset($this->basicActions['translate']);
     if ($request->isMethod('post')) {
         $this->form->bind($request->getPostParameters());
         if ($this->form->isValid()) {
             $this->processForm();
             $this->redirect(array($this->resource, 'module' => 'aclGroup', 'action' => 'indexActorAcl'));
         }
     }
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:29,代码来源:editActorAclAction.class.php

示例15: create

 public function create($aData)
 {
     $oConnection = Propel::getConnection(ProcessUserPeer::DATABASE_NAME);
     try {
         $criteria = new Criteria('workflow');
         $criteria->add(ProcessUserPeer::PU_UID, $aData['PU_UID']);
         $criteria->add(ProcessUserPeer::PRO_UID, $aData['PRO_UID']);
         $criteria->add(ProcessUserPeer::USR_UID, $aData['USR_UID']);
         $criteria->add(ProcessUserPeer::PU_TYPE, $aData['PU_TYPE']);
         $objects = ProcessUserPeer::doSelect($criteria, $oConnection);
         $oConnection->begin();
         foreach ($objects as $row) {
             $this->remove($row->getTasUid(), $row->getUsrUid(), $row->getTuType(), $row->getTuRelation());
         }
         $oConnection->commit();
         $oProcessUser = new ProcessUser();
         $oProcessUser->fromArray($aData, BasePeer::TYPE_FIELDNAME);
         if ($oProcessUser->validate()) {
             $oConnection->begin();
             $iResult = $oProcessUser->save();
             $oConnection->commit();
             return $iResult;
         } else {
             $sMessage = '';
             $aValidationFailures = $oProcessUser->getValidationFailures();
             foreach ($aValidationFailures as $oValidationFailure) {
                 $sMessage .= $oValidationFailure->getMessage() . '<br />';
             }
             throw new Exception('The registry cannot be created!<br />' . $sMessage);
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
开发者ID:nshong,项目名称:processmaker,代码行数:35,代码来源:ProcessUser.php


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