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


PHP Model\CustomerQuery类代码示例

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


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

示例1: verifyExistingEmail

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

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

示例3: loadStatsAjaxAction

 public function loadStatsAjaxAction()
 {
     if (null !== ($response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW))) {
         return $response;
     }
     $data = new \stdClass();
     $data->title = $this->getTranslator()->trans("Stats on %month/%year", array('%month' => $this->getRequest()->query->get('month', date('m')), '%year' => $this->getRequest()->query->get('year', date('Y'))));
     /* sales */
     $saleSeries = new \stdClass();
     $saleSeries->color = $this->getRequest()->query->get('sales_color', '#adadad');
     $saleSeries->data = OrderQuery::getMonthlySaleStats($this->getRequest()->query->get('month', date('m')), $this->getRequest()->query->get('year', date('Y')));
     /* new customers */
     $newCustomerSeries = new \stdClass();
     $newCustomerSeries->color = $this->getRequest()->query->get('customers_color', '#f39922');
     $newCustomerSeries->data = CustomerQuery::getMonthlyNewCustomersStats($this->getRequest()->query->get('month', date('m')), $this->getRequest()->query->get('year', date('Y')));
     /* orders */
     $orderSeries = new \stdClass();
     $orderSeries->color = $this->getRequest()->query->get('orders_color', '#5cb85c');
     $orderSeries->data = OrderQuery::getMonthlyOrdersStats($this->getRequest()->query->get('month', date('m')), $this->getRequest()->query->get('year', date('Y')));
     /* first order */
     $firstOrderSeries = new \stdClass();
     $firstOrderSeries->color = $this->getRequest()->query->get('first_orders_color', '#5bc0de');
     $firstOrderSeries->data = OrderQuery::getFirstOrdersStats($this->getRequest()->query->get('month', date('m')), $this->getRequest()->query->get('year', date('Y')));
     /* cancelled orders */
     $cancelledOrderSeries = new \stdClass();
     $cancelledOrderSeries->color = $this->getRequest()->query->get('cancelled_orders_color', '#d9534f');
     $cancelledOrderSeries->data = OrderQuery::getMonthlyOrdersStats($this->getRequest()->query->get('month', date('m')), $this->getRequest()->query->get('year', date('Y')), array(5));
     $data->series = array($saleSeries, $newCustomerSeries, $orderSeries, $firstOrderSeries, $cancelledOrderSeries);
     $json = json_encode($data);
     return $this->jsonResponse($json);
 }
开发者ID:badelas,项目名称:thelia,代码行数:31,代码来源:HomeController.php

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

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

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

示例7: verifyExistingEmail

 /**
  * @param $value
  * @param ExecutionContextInterface $context
  */
 public function verifyExistingEmail($value, ExecutionContextInterface $context)
 {
     $customer = CustomerQuery::getCustomerByEmail($value);
     // If there is already a customer for this email address and if the customer is different from the current user, do a violation
     if ($customer && $customer->getId() != $this->getRequest()->getSession()->getCustomerUser()->getId()) {
         $context->addViolation(Translator::getInstance()->trans("This email already exists."));
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:12,代码来源:CustomerProfileUpdateForm.php

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

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

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

示例11: loadStatsAjaxAction

 public function loadStatsAjaxAction()
 {
     if (null !== ($response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW))) {
         return $response;
     }
     $cacheExpire = ConfigQuery::getAdminCacheHomeStatsTTL();
     $cacheContent = false;
     $month = (int) $this->getRequest()->query->get('month', date('m'));
     $year = (int) $this->getRequest()->query->get('year', date('Y'));
     if ($cacheExpire) {
         $context = "_" . $month . "_" . $year;
         $cacheKey = self::STATS_CACHE_KEY . $context;
         $cacheDriver = new FilesystemCache($this->getCacheDir());
         if (!$this->getRequest()->query->get('flush', "0")) {
             $cacheContent = $cacheDriver->fetch($cacheKey);
         } else {
             $cacheDriver->delete($cacheKey);
         }
     }
     if ($cacheContent === false) {
         $data = new \stdClass();
         $data->title = $this->getTranslator()->trans("Stats on %month/%year", ['%month' => $month, '%year' => $year]);
         /* sales */
         $saleSeries = new \stdClass();
         $saleSeries->color = self::testHexColor('sales_color', '#adadad');
         $saleSeries->data = OrderQuery::getMonthlySaleStats($month, $year);
         /* new customers */
         $newCustomerSeries = new \stdClass();
         $newCustomerSeries->color = self::testHexColor('customers_color', '#f39922');
         $newCustomerSeries->data = CustomerQuery::getMonthlyNewCustomersStats($month, $year);
         /* orders */
         $orderSeries = new \stdClass();
         $orderSeries->color = self::testHexColor('orders_color', '#5cb85c');
         $orderSeries->data = OrderQuery::getMonthlyOrdersStats($month, $year);
         /* first order */
         $firstOrderSeries = new \stdClass();
         $firstOrderSeries->color = self::testHexColor('first_orders_color', '#5bc0de');
         $firstOrderSeries->data = OrderQuery::getFirstOrdersStats($month, $year);
         /* cancelled orders */
         $cancelledOrderSeries = new \stdClass();
         $cancelledOrderSeries->color = self::testHexColor('cancelled_orders_color', '#d9534f');
         $cancelledOrderSeries->data = OrderQuery::getMonthlyOrdersStats($month, $year, array(5));
         $data->series = array($saleSeries, $newCustomerSeries, $orderSeries, $firstOrderSeries, $cancelledOrderSeries);
         $cacheContent = json_encode($data);
         if ($cacheExpire) {
             $cacheDriver->save($cacheKey, $cacheContent, $cacheExpire);
         }
     }
     return $this->jsonResponse($cacheContent);
 }
开发者ID:margery,项目名称:thelia,代码行数:50,代码来源:HomeController.php

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

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

示例14: getExistingObject

 protected function getExistingObject()
 {
     return CustomerQuery::create()->findPk($this->getRequest()->get('customer_id', 0));
 }
开发者ID:badelas,项目名称:thelia,代码行数:4,代码来源:CustomerController.php

示例15: deleteAction

 public function deleteAction($entityId)
 {
     $query = CustomerQuery::create()->joinOrder()->filterById($entityId)->findOne();
     if (null !== $query) {
         throw new HttpException(403, json_encode(["error" => sprintf("You can't delete the customer %d as he has orders", $entityId)]));
     }
     return parent::deleteAction($entityId);
 }
开发者ID:badelas,项目名称:thelia,代码行数:8,代码来源:CustomerController.php


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