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


PHP CustomerQuery::create方法代码示例

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


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

示例1: verifyExistingEmail

 public function verifyExistingEmail($value, ExecutionContextInterface $context)
 {
     $customer = CustomerQuery::create()->findOneByEmail($value);
     if (null === $customer) {
         $context->addViolation(Translator::getInstance()->trans("This email does not exists"));
     }
 }
开发者ID:badelas,项目名称:thelia,代码行数:7,代码来源:CustomerLostPasswordForm.php

示例2: doSearch

 /**
  * @param OrderQuery $search
  * @param $searchTerm
  * @param $searchIn
  * @param $searchCriteria
  */
 public function doSearch(&$search, $searchTerm, $searchIn, $searchCriteria)
 {
     $search->_and();
     foreach ($searchIn as $index => $searchInElement) {
         if ($index > 0) {
             $search->_or();
         }
         switch ($searchInElement) {
             case 'ref':
                 $search->filterByRef($searchTerm, $searchCriteria);
                 break;
             case 'invoice_ref':
                 $search->filterByInvoiceRef($searchTerm, $searchCriteria);
                 break;
             case 'customer_ref':
                 $search->filterByCustomer(CustomerQuery::create()->filterByRef($searchTerm, $searchCriteria)->find());
                 break;
             case 'customer_firstname':
                 $search->filterByOrderAddressRelatedByInvoiceOrderAddressId(OrderAddressQuery::create()->filterByFirstname($searchTerm, $searchCriteria)->find());
                 break;
             case 'customer_lastname':
                 $search->filterByOrderAddressRelatedByInvoiceOrderAddressId(OrderAddressQuery::create()->filterByLastname($searchTerm, $searchCriteria)->find());
                 break;
             case 'customer_email':
                 $search->filterByCustomer(CustomerQuery::create()->filterByEmail($searchTerm, $searchCriteria)->find());
                 break;
         }
     }
 }
开发者ID:adirkuhn,项目名称:thelia,代码行数:35,代码来源:Order.php

示例3: loginAction

 public function loginAction()
 {
     $customerController = new BaseCustomerController();
     $customerController->setContainer($this->container);
     $response = $customerController->loginAction();
     if (!$this->getSecurityContext()->hasCustomerUser()) {
         $request = $this->getRequest();
         $customerLoginForm = new CustomerLogin($request);
         try {
             $form = $this->validateForm($customerLoginForm, "post");
             $request = CustomerTempQuery::create();
             $customerTemp = $request->where('`customer_temp`.email = ?', $form->get('email')->getData(), \PDO::PARAM_STR)->where('`customer_temp`.password = PASSWORD(?)', $form->get('password')->getData(), \PDO::PARAM_STR)->where('`customer_temp`.processed = 0')->findOne();
             if (null !== $customerTemp) {
                 $customer = CustomerQuery::create()->findOneByEmail($form->get('email')->getData());
                 $customer->setPassword($form->get('password')->getData())->save();
                 $customerTemp->setProcessed(true)->save();
                 $this->dispatch(TheliaEvents::CUSTOMER_LOGIN, new CustomerLoginEvent($customer));
                 $successUrl = $customerLoginForm->getSuccessUrl();
                 $response = RedirectResponse::create($successUrl);
             }
         } catch (\Exception $e) {
         }
     }
     return $response;
 }
开发者ID:JumBay,项目名称:ImportT1,代码行数:25,代码来源:CustomerController.php

示例4: testRenderLoop

 public function testRenderLoop()
 {
     $customerId = CustomerQuery::create()->findOne()->getId();
     $this->handler->expects($this->any())->method("buildDataSet")->willReturn($this->handler->renderLoop("address", ["customer" => $customerId]));
     $lang = Lang::getDefaultLanguage();
     $loop = $this->handler->buildDataSet($lang);
     $this->assertInstanceOf("Thelia\\Core\\Template\\Loop\\Address", $loop);
     $data = $this->handler->buildData($lang);
     $addresses = AddressQuery::create()->filterByCustomerId($customerId)->find()->toArray("Id");
     foreach ($data->getData() as $row) {
         $this->assertArrayHasKey("id", $row);
         $this->assertArrayHasKey($row["id"], $addresses);
         $this->assertEquals(count($addresses), $row["loop_total"]);
         $address = $addresses[$row["id"]];
         $this->assertEquals($row["address1"], $address["Address1"]);
         $this->assertEquals($row["address2"], $address["Address2"]);
         $this->assertEquals($row["address3"], $address["Address3"]);
         $this->assertEquals($row["cellphone"], $address["Cellphone"]);
         $this->assertEquals($row["city"], $address["City"]);
         $this->assertEquals($row["company"], $address["Company"]);
         $this->assertEquals($row["country"], $address["CountryId"]);
         $this->assertEquals($row["create_date"], $address["CreatedAt"]);
         $this->assertEquals($row["update_date"], $address["UpdatedAt"]);
         $this->assertEquals($row["firstname"], $address["Firstname"]);
         $this->assertEquals($row["lastname"], $address["Lastname"]);
         $this->assertEquals($row["id"], $address["Id"]);
         $this->assertEquals($row["label"], $address["Label"]);
         $this->assertEquals($row["phone"], $address["Phone"]);
         $this->assertEquals($row["title"], $address["TitleId"]);
         $this->assertEquals($row["zipcode"], $address["Zipcode"]);
     }
 }
开发者ID:alex63530,项目名称:thelia,代码行数:32,代码来源:ExportHandlerTest.php

示例5: createShoppingFluxCustomer

 /**
  * @return Customer
  */
 public static function createShoppingFluxCustomer()
 {
     $shoppingFluxCustomer = CustomerQuery::create()->findOneByRef("ShoppingFlux");
     if (null === $shoppingFluxCustomer) {
         $shoppingFluxCustomer = new Customer();
         $shoppingFluxCustomer->setRef("ShoppingFlux")->setCustomerTitle(CustomerTitleQuery::create()->findOne())->setLastname("ShoppingFlux")->setFirstname("ShoppingFlux")->save();
     }
     return $shoppingFluxCustomer;
 }
开发者ID:ThomasArnaud,项目名称:ShoppingFlux,代码行数:12,代码来源:ShoppingFluxConfigQuery.php

示例6: verifyExistingEmail

 /**
  * If the user select "I'am a new customer", we make sure is email address does not exit in the database.
  */
 public function verifyExistingEmail($value, ExecutionContextInterface $context)
 {
     $data = $context->getRoot()->getData();
     if ($data["account"] == 0) {
         $customer = CustomerQuery::create()->findOneByEmail($value);
         if ($customer) {
             $context->addViolation(Translator::getInstance()->trans("A user already exists with this email address. Please login or if you've forgotten your password, go to Reset Your Password."));
         }
     }
 }
开发者ID:margery,项目名称:thelia,代码行数:13,代码来源:CustomerLogin.php

示例7: verifyCurrentPasswordField

 public function verifyCurrentPasswordField($value, ExecutionContextInterface $context)
 {
     /**
      * Retrieve the user recording, because after the login action, the password is deleted in the session
      */
     $userId = $this->getRequest()->getSession()->getCustomerUser()->getId();
     $user = CustomerQuery::create()->findPk($userId);
     // Check if value of the old password match the password of the current user
     if (!password_verify($value, $user->getPassword())) {
         $context->addViolation(Translator::getInstance()->trans("Your current password does not match."));
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:12,代码来源:CustomerPasswordUpdateForm.php

示例8: preImport

 public function preImport()
 {
     // Empty address, customer and customer title table
     OrderQuery::create()->deleteAll();
     AddressQuery::create()->deleteAll();
     OrderAddressQuery::create()->deleteAll();
     CustomerQuery::create()->deleteAll();
     // Also empty url rewriting table
     $con = Propel::getConnection(RewritingUrlTableMap::DATABASE_NAME);
     $con->exec('SET FOREIGN_KEY_CHECKS=0');
     RewritingUrlQuery::create()->deleteAll();
     $con->exec('SET FOREIGN_KEY_CHECKS=1');
     $this->cust_corresp->reset();
     if ($this->thelia_version > 150) {
         $this->importCustomerTitle();
     }
 }
开发者ID:JumBay,项目名称:ImportT1,代码行数:17,代码来源:CustomersImport.php

示例9: addAmount

 public function addAmount()
 {
     if (null !== ($response = $this->checkAuth(array(AdminResources::CUSTOMER), array('CreditAccount'), AccessManager::UPDATE))) {
         return $response;
     }
     $form = new CreditAccountForm($this->getRequest());
     try {
         $creditForm = $this->validateForm($form);
         $customer = CustomerQuery::create()->findPk($creditForm->get('customer_id')->getData());
         $event = new CreditAccountEvent($customer, $creditForm->get('amount')->getData());
         /** @var  Admin $admin */
         $admin = $this->getSession()->getAdminUser();
         $event->setWhoDidIt($admin->getFirstname() . " " . $admin->getLastname());
         $this->dispatch(CreditAccount::CREDIT_ACCOUNT_ADD_AMOUNT, $event);
     } catch (\Exception $ex) {
         $this->setupFormErrorContext($this->getTranslator()->trans("Add amount to credit account"), $ex->getMessage(), $form, $ex);
     }
     return $this->generateRedirect($form->getSuccessUrl());
 }
开发者ID:gillesbourgeat,项目名称:CreditAccount,代码行数:19,代码来源:CreditAccountAdminController.php

示例10: delete

 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param      ConnectionInterface $con
  * @return void
  * @throws PropelException
  * @see Customer::setDeleted()
  * @see Customer::isDeleted()
  */
 public function delete(ConnectionInterface $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getServiceContainer()->getWriteConnection(CustomerTableMap::DATABASE_NAME);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = ChildCustomerQuery::create()->filterByPrimaryKey($this->getPrimaryKey());
         $ret = $this->preDelete($con);
         if ($ret) {
             $deleteQuery->delete($con);
             $this->postDelete($con);
             $con->commit();
             $this->setDeleted(true);
         } else {
             $con->commit();
         }
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }
开发者ID:shirone,项目名称:thelia,代码行数:34,代码来源:Customer.php

示例11: getCreationEvent

 /**
  * Creates the creation event with the provided form data
  *
  * @param unknown $formData
  */
 protected function getCreationEvent($formData)
 {
     $event = $this->getCreateOrUpdateEvent($formData);
     $customer = CustomerQuery::create()->findPk($this->getRequest()->get("customer_id"));
     $event->setCustomer($customer);
     return $event;
 }
开发者ID:NandoKstroNet,项目名称:thelia,代码行数:12,代码来源:AddressController.php

示例12: testCheckLoginWithWrongPassword

 /**
  * @covers \Thelia\Controller\Api\CustomerController::checkLoginAction
  */
 public function testCheckLoginWithWrongPassword()
 {
     $logins = ['email' => CustomerQuery::create()->findPk(1)->getEmail(), 'password' => 'notthis'];
     $requestContent = json_encode($logins);
     $client = static::createClient();
     $servers = $this->getServerParameters();
     $servers['CONTENT_TYPE'] = 'application/json';
     $client->request('POST', '/api/customers/checkLogin?&sign=' . $this->getSignParameter($requestContent), [], [], $servers, $requestContent);
     $this->assertEquals(404, $client->getResponse()->getStatusCode());
 }
开发者ID:margery,项目名称:thelia,代码行数:13,代码来源:CustomerControllerTest.php

示例13: parseResults

 public function parseResults(LoopResult $loopResult)
 {
     /** @var \Thelia\Model\Customer $customer */
     foreach ($loopResult->getResultDataCollection() as $customer) {
         $loopResultRow = new LoopResultRow($customer);
         $loopResultRow->set("ID", $customer->getId())->set("REF", $customer->getRef())->set("TITLE", $customer->getTitleId())->set("FIRSTNAME", $customer->getFirstname())->set("LASTNAME", $customer->getLastname())->set("EMAIL", $customer->getEmail())->set("RESELLER", $customer->getReseller())->set("SPONSOR", $customer->getSponsor())->set("DISCOUNT", $customer->getDiscount())->set("NEWSLETTER", $customer->getVirtualColumn("is_registered_to_newsletter"));
         if ($this->getWithPrevNextInfo()) {
             // Find previous and next category
             $previousQuery = CustomerQuery::create()->filterById($customer->getId(), Criteria::LESS_THAN);
             $previous = $previousQuery->orderById(Criteria::DESC)->findOne();
             $nextQuery = CustomerQuery::create()->filterById($customer->getId(), Criteria::GREATER_THAN);
             $next = $nextQuery->orderById(Criteria::ASC)->findOne();
             $loopResultRow->set("HAS_PREVIOUS", $previous != null ? 1 : 0)->set("HAS_NEXT", $next != null ? 1 : 0)->set("PREVIOUS", $previous != null ? $previous->getId() : -1)->set("NEXT", $next != null ? $next->getId() : -1);
         }
         $this->addOutputFields($loopResultRow, $customer);
         $loopResult->addRow($loopResultRow);
     }
     return $loopResult;
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:19,代码来源:Customer.php

示例14: getUser

 public function getUser($dataArray)
 {
     return CustomerQuery::create()->filterByEmail($dataArray['username'], Criteria::EQUAL)->filterByRememberMeSerial($dataArray['serial'], Criteria::EQUAL)->filterByRememberMeToken($dataArray['token'], Criteria::EQUAL)->findOne();
 }
开发者ID:margery,项目名称:thelia,代码行数:4,代码来源:CustomerTokenUserProvider.php

示例15: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     CustomerQuery::create()->filterByRef('testRef')->delete();
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:4,代码来源:CustomerTest.php


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