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


PHP ServiceFactory::getService方法代码示例

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


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

示例1: beforeDispatch

 /**
  * This action is executed before execute any action in the application
  *
  * @param Event $event
  * @param Dispatcher $dispatcher
  */
 public function beforeDispatch(Event $event, Dispatcher $dispatcher)
 {
     $userGroup = 'guest';
     $isLoggedIn = $this->isLoggedIn($this->session);
     if ($isLoggedIn) {
         $uid = $this->session->get('uid');
         $userService = ServiceFactory::getService('UserService');
         $user = $userService->getUserUsingUid($uid);
         $userGroup = $user['userGroup']['userGroupSlug'];
     }
     $controller = $dispatcher->getControllerName();
     $action = $dispatcher->getActionName();
     $acl = $this->getAcl();
     $isAllowed = $acl->isAllowed($userGroup, $controller, $action);
     if ($isAllowed != Acl::ALLOW) {
         $dispatcher->forward(array('controller' => 'errors', 'action' => 'resourceNotFound'));
         return false;
     }
 }
开发者ID:kelliany,项目名称:TestZilla,代码行数:25,代码来源:AccessControlPlugin.php

示例2: getQueryOfIssuesUsingHunterUsernameAndProductAndCategoryAndStatus

 /**
  * Get the conditions of query statement.
  * @param  String $hunterUsername  - the username who founded the issue
  * @param  long   $productId       - the unique ID of the product
  * @param  int    $issueCategoryId - the unique ID of a category of issue
  * @param  int    $issueStatusId   - the unique ID of a status of issue
  * @return the conditions of query statement
  */
 private function getQueryOfIssuesUsingHunterUsernameAndProductAndCategoryAndStatus($hunterUsername, $productId, $issueCategoryId, $issueStatusId)
 {
     $hunterUid = 0;
     if (!empty($hunterUsername)) {
         $userService = ServiceFactory::getService('UserService');
         $hunter = $userService->getUserUsingUsername($hunterUsername);
         $hunterUid = $hunter == NULL ? -1 : $hunter->getUid();
     }
     return $this->getQueryOfIssuesUsingHunterUidAndProductAndCategoryAndStatus($hunterUid, $productId, $issueCategoryId, $issueStatusId);
 }
开发者ID:kelliany,项目名称:TestZilla,代码行数:18,代码来源:IssueService.php

示例3: NuevoClienteRequest

<?php

require_once '../header.inc.php';
$svcAlta = ServiceFactory::getService('nuevo');
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $request = new NuevoClienteRequest();
    $request->razon_social = $_POST['razon_social'];
    $request->numero_cliente = $_POST['numero_cliente'];
    $request->telefono = $_POST['telefono'];
    $request->contacto = $_POST['contacto'];
    $request->calle = $_POST['calle'];
    $request->puerta = $_POST['puerta'];
    $request->piso = $_POST['piso'];
    $request->localidad = $_POST['localidad'];
    $request->provincia = $_POST['provincia'];
    $request->dia_entrega = $_POST['dia_entrega'];
    $request->dia_venta = $_POST['dia_venta'];
    $request->dia_cobranza = $_POST['dia_cobranza'];
    $nuevo = $svcAlta->guardarCliente($request);
    if ($nuevo) {
        header('location: listado.php');
    }
}
include ROOT_PATH . '/views/main.php';
开发者ID:juyagu,项目名称:Analia,代码行数:24,代码来源:nuevo_cliente.php

示例4:

<?php

require_once '../../header.inc.php';
$svcListado = ServiceFactory::getService('listado');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $pagina = $_POST['pagina'];
    $listado = $svcListado->getListado($pagina);
    echo json_encode($listado);
    exit;
}
开发者ID:juyagu,项目名称:Analia,代码行数:10,代码来源:cargar_listado.php

示例5: getCurrentUserObject

 /**
  * Get current User object from session.
  * @param  Session $session - the HTTP Session
  * @return the current User object or NULL
  */
 protected function getCurrentUserObject($session)
 {
     $userService = ServiceFactory::getService('UserService');
     $uid = $session->get('uid');
     return $userService->getUserObjectUsingUid($uid);
 }
开发者ID:kelliany,项目名称:TestZilla,代码行数:11,代码来源:BaseController.php

示例6: displayAction

 public function displayAction()
 {
     $userId = isset($_GET['userId']) ? $_GET['userId'] : "1";
     $userDetail = ServiceFactory::getService("User")->getDetail($userId);
     echo ServiceFactory::getService("Tpl")->render("index", array("username" => $userDetail['username'], "password" => $userDetail['password'], "age" => $userDetail['age'], "createTime" => $userDetail['createTime']));
 }
开发者ID:it114,项目名称:witness,代码行数:6,代码来源:IndexController.php

示例7: createIssueAction

 /**
  * Create an issue of a product.
  * @param  long $productId - the unique ID of the product
  * @return an HttpResponse contains data validation result
  */
 public function createIssueAction($productId)
 {
     $issueTitle = $this->getFilteredContent(strip_tags($this->request->getPost('issueTitle')));
     $issueCategorySlug = $this->getFilteredContent(strip_tags($this->request->getPost('issueCategory')));
     $productVersion = $this->getFilteredContent(strip_tags($this->request->getPost('productVersion')));
     $issueDescription = $this->getFilteredContent(strip_tags($this->request->getPost('issueDescription')));
     $isTokenValid = $this->security->checkToken();
     $productService = ServiceFactory::getService('ProductService');
     $issueService = ServiceFactory::getService('IssueService');
     $product = $productService->getProductObjectUsingId($productId);
     $hunter = $this->getCurrentUserObject($this->session);
     if ($product == NULL) {
         $this->forward('errors/resourceNotFound');
         return;
     }
     $result = $issueService->createIssue($product, $productVersion, $issueCategorySlug, $hunter, $issueTitle, $issueDescription, $isTokenValid);
     if ($isTokenValid) {
         $result['csrfTokenKey'] = $this->security->getTokenKey();
         $result['csrfToken'] = $this->security->getToken();
     }
     if ($isSuccessful) {
         $issueId = $result['issueId'];
         $ipAddress = $this->request->getClientAddress();
         $this->logger->log(sprintf('Issue #%d created by User[%s] at %s.', $issueId, $hunter, $ipAddress), Logger::INFO);
     }
     $response = new Response();
     $response->setHeader('Content-Type', 'application/json');
     $response->setContent(json_encode($result));
     return $response;
 }
开发者ID:kelliany,项目名称:TestZilla,代码行数:35,代码来源:ProductsController.php

示例8: getSubmittedIssuesAction

 /**
  * Get issues list submitted by the user logged in.
  * @return a HttpResponse contains JSON data contains information of issues submitted by the user
  */
 public function getSubmittedIssuesAction()
 {
     $hunterUid = $this->session->get('uid');
     $productId = $this->request->get('product');
     $issueCategorySlug = $this->request->get('issueCategory');
     $issueStatusSlug = $this->request->get('issueStatus');
     $pageNumber = $this->request->get('page');
     $limit = self::NUMBER_OF_ISSUES_PER_REQUEST;
     $offset = $pageNumber <= 1 ? 0 : ($pageNumber - 1) * $limit;
     $issueService = ServiceFactory::getService('IssueService');
     $issueCategoryId = $issueService->getIssueCategoryId($issueCategorySlug);
     $issueStatusId = $issueService->getIssueStatusId($issueStatusSlug);
     $issues = $this->getIssuesInBestLanguage($issueService->getIssuesUsingHunterUidAndProductAndCategoryAndStatus($hunterUid, $productId, $issueCategoryId, $issueStatusId, $offset, $limit));
     $numberOfIssues = $issueService->getIssuesCountUsingHunterUidAndProductAndCategoryAndStatus($hunterUid, $productId, $issueCategoryId, $issueStatusId);
     $result = array('isSuccessful' => !empty($issues), 'issues' => $issues, 'totalPages' => ceil($numberOfIssues / $limit));
     $response = new Response();
     $response->setHeader('Content-Type', 'application/json');
     $response->setContent(json_encode($result));
     return $response;
 }
开发者ID:kelliany,项目名称:TestZilla,代码行数:24,代码来源:DashboardController.php

示例9: doResetPasswordAction

 /**
  * Reset the password if the email and token is correct.
  * @return an HttpResponse which contains JSON data infers whether the password is reset
  */
 public function doResetPasswordAction()
 {
     $email = $this->request->get('email');
     $token = $this->request->get('token');
     $newPassword = $this->request->get('newPassword');
     $confirmPassword = $this->request->get('confirmPassword');
     $isTokenValid = $this->security->checkToken();
     $userService = ServiceFactory::getService('UserService');
     $result = $userService->resetPassword($email, $token, $newPassword, $confirmPassword, $isTokenValid);
     if ($isTokenValid) {
         $result['csrfTokenKey'] = $this->security->getTokenKey();
         $result['csrfToken'] = $this->security->getToken();
     }
     if ($result['isSuccessful']) {
         $user = $userService->getUserUsingUsernameOrEmail($email);
         $ipAddress = $this->request->getClientAddress();
         $this->logger->log(sprintf('User: [%s] reset password at %s.', $user, $ipAddress), Logger::INFO);
     }
     $response = new Response();
     $response->setHeader('Content-Type', 'application/json');
     $response->setContent(json_encode($result));
     return $response;
 }
开发者ID:kelliany,项目名称:TestZilla,代码行数:27,代码来源:AccountsController.php


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