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


PHP Service::get方法代码示例

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


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

示例1: __construct

 public function __construct(Service $service)
 {
     $this->db = $db;
     //Выборка всех категорий для меню т.к. используются на всех страницах публичной части
     $this->category = $service->get('category_mapper')->getAll();
     $this->basket_info = Basket::getBasketInfo();
 }
开发者ID:lexdss,项目名称:shop,代码行数:7,代码来源:View.php

示例2: addItem

 /**
  * Ajoute un item au cache et le tag avec "id:nomId" de l'utilisateur connecté.
  * @param type $key
  * @param type $data
  */
 protected function addItem($key, $data)
 {
     $auth = $this->service->get('zfcuser_auth_service');
     $tag = $auth->hasIdentity() ? $auth->getIdentity()->getId() . ':' . $auth->getIdentity()->getUsername() : "undefined";
     $this->cache->addItem($key, $data);
     $this->cache->setTags($key, array($tag));
 }
开发者ID:antarus,项目名称:mystra-pve,代码行数:12,代码来源:AbstractClient.php

示例3: getAll

 /**
  * @param PagingSearch $ps
  *
  * @return Course[]
  */
 public function getAll(PagingSearch $ps = null)
 {
     $response = $this->service->get('/courses', $ps);
     $xml = new \SimpleXMLElement($response);
     $courses = array();
     $course_nodes = $xml->children();
     foreach ($course_nodes as $course_node) {
         $id = (string) $course_node->Id;
         $code = (string) $course_node->Code;
         $name = (string) $course_node->Name;
         $active = filter_var((string) $course_node->Active, FILTER_VALIDATE_BOOLEAN);
         $course = new Course($id, $code, $name, $active);
         $courses[] = $course;
     }
     return $courses;
 }
开发者ID:rogerthomas84,项目名称:litmos-php,代码行数:21,代码来源:Courses.php

示例4: view_filter

/**
 *  @postRoute View
 *  @Last
 */
function view_filter($req, $args, $params)
{
    if (empty($args)) {
        throw new \RuntimeException("@View expects one argument");
    }
    $view = Service::get("view")->get(current($args), []);
    echo $view->render($params);
    return $params;
}
开发者ID:crodas,项目名称:framework,代码行数:13,代码来源:Views.php

示例5: loginAction

 public function loginAction()
 {
     $post = $this->getPOST();
     $I18n = \Service::get('translator');
     $errors = array();
     if ($this->getUserCardManager()->getCard() && $this->getUserCardManager()->getCard()->getRole() == 'USER') {
         return $this->redirectResponse($this->buildUrl($this->route_landing));
     }
     if (count($post)) {
         $username = array_key_exists('_username', $post) && $post['_username'] != '' ? $post['_username'] : null;
         $password = array_key_exists('_password', $post) && $post['_password'] != '' ? $post['_password'] : null;
         if (!$username) {
             $errors['_username'] = $I18n->get('user.user_required');
         }
         if (!$password) {
             $errors['_password'] = $I18n->get('user.password_required');
         }
         if (count($errors) == 0) {
             // Busca al usuario en la base de datos.
             $User = $this->searchUser($username, $password);
             if ($User) {
                 // Espera
                 if ($User->status == 2) {
                     if ($this->need_approval) {
                         return $this->redirectResponse($this->buildUrl('user-not-approved'));
                     }
                     if (!$this->isValidEmail($User)) {
                         return $this->redirectResponse($this->buildUrl('user-unconfirme-email'));
                     }
                 }
                 // Activo
                 if ($User->status == 1) {
                     if (!$this->isValidEmail($User)) {
                         // Agrega el id del usuario en la sesion para generar el token y enviarlo por correo.
                         $this->getSession()->set('tmp_user_id', $User->id);
                         return $this->redirectResponse($this->buildUrl('user-unconfirme-email'));
                     }
                 }
                 // Desactivo
                 if ($User->status == 0) {
                     return $this->redirectResponse($this->buildUrl('user-invalid-account'));
                 }
                 $User->last_logging = $this->getTimestamp();
                 // Actualiza la fecha del ultimo login del usuario
                 $this->getDB()->model($this->model)->save($User);
                 $this->createUserCard($User);
                 $this->getView()->msgSuccess($I18n->get('user.welcome') . " {$User->first_name} {$User->last_name}");
                 return $this->redirectResponse($this->buildUrl($this->route_landing));
             } else {
                 $this->getView()->msgSuccess($I18n->get('user.login_failed'));
                 $errors['global'] = "El usuario o la clave es incorrecta.";
             }
         }
     }
     return $this->render('Dinnovos\\Users:Session:login', array('errors' => $errors));
 }
开发者ID:kodazzi,项目名称:amazonas,代码行数:56,代码来源:SessionController.php

示例6: main

/** 
 *  @Cli("user:create") 
 *  @Arg("email", REQUIRED)
 *  @Arg("password", REQUIRED)
 */
function main($input, $output)
{
    $email = $input->getArgument('email');
    $password = $input->getArgument('password');
    $output->writeln("<info>Creating user {$email}</info>");
    $user = new \Model\User();
    $user->email = $email;
    $user->password = $password;
    \Service::get("db")->save($user);
}
开发者ID:crodas,项目名称:framework,代码行数:15,代码来源:create_user.php

示例7: check

 public static function check()
 {
     Service::get("session");
     if (empty($_SESSION['user_id'])) {
         return false;
     }
     if (empty(self::$user)) {
         self::$user = self::getCollection()->findOne(['_id' => $_SESSION['user_id']]);
     }
     return !empty(self::$user);
 }
开发者ID:crodas,项目名称:framework,代码行数:11,代码来源:Auth.php

示例8: getUserInfo

 public static function getUserInfo($ret, $usr)
 {
     $params = array();
     $url = 'http://127.0.0.1:9502/sync';
     //$url = 'http://192.112.121.122/store.php?id=3269';
     //$url = 'http://localhost/';
     return Service::get($url, $params)->then(function ($promise) use($ret) {
         $data = $promise->get('http_data');
         $promise->accept([$ret => $data]);
     });
 }
开发者ID:imdaqian,项目名称:swPromise,代码行数:11,代码来源:Index.class.php

示例9: functionsView

 private function functionsView()
 {
     \Service::get('view')->addFunction('page', function ($where = array()) {
         return \Page::showContent($where);
     });
     \Service::get('view')->addFunction('slab', function ($where = array()) {
         return \Slab::showContent($where);
     });
     \Service::get('view')->addFunction('carousel', function ($where = array()) {
         return \Carousel::show($where);
     });
 }
开发者ID:kodazzi,项目名称:amazonas,代码行数:12,代码来源:AmazonasProviders.php

示例10: editAction

 public function editAction()
 {
     $id = $this->getParameters('param1');
     $Item = \Service::get('db')->model($this->namespace_model)->fetch(array('id' => $id));
     $Form = $this->getForm($this->namespace_form, $Item);
     $Form->getWidget('status')->setHidden(false);
     $Form->getWidget('email_confirm')->setHidden(false);
     $result = $this->saveForm($Form, $Item);
     if ($result instanceof RedirectResponse) {
         return $result;
     }
     return $this->render("{$this->namespace_bundle}:{$this->view}:{$this->action}", array('item' => $Item));
 }
开发者ID:kodazzi,项目名称:amazonas,代码行数:13,代码来源:UsersController.php

示例11: deleteAction

 public function deleteAction()
 {
     $id = $this->getParameters('param1');
     $Item = \Service::get('db')->model($this->namespace_model)->fetch(array('id' => $id));
     if ($Item) {
         if ($this->namespace_model_translation) {
             \Service::get('db')->model($this->namespace_model_translation)->delete(array('translatable_id' => $id));
         }
         \Service::get('db')->model($this->namespace_model)->delete(array('id' => $id));
         return $this->redirectResponse($this->buildUrl($this->default_route, array('bundle' => 'pages', 'controller' => $this->controller, 'action' => 'list')));
     }
     return $this->responseError404();
 }
开发者ID:kodazzi,项目名称:amazonas,代码行数:13,代码来源:AdminBundleController.php

示例12: valid

 public function valid()
 {
     // Permite que el password tenga letras en minusculas, mayusculas y numeros.
     $default = \Kodazzi\Tools\RegularExpression::get('password');
     if ($this->pattern) {
         $default = $this->pattern;
     }
     if (preg_match('/' . $default . '/', $this->value)) {
         $this->value = \Service::get('session')->encript($this->value);
         return true;
     }
     return false;
 }
开发者ID:kodazzi,项目名称:framework,代码行数:13,代码来源:Password.php

示例13: getOneWithTranslations

 public function getOneWithTranslations($id = null)
 {
     $primary = $this->propertiesInstance['primary'];
     $result = $this->buildQuery($id)->execute()->fetchObject($this->propertiesInstance['namespace']);
     if (!$result) {
         return false;
     }
     if (!$this->propertiesInstance['model_translation'] || !$this->propertiesInstance['model_language']) {
         throw new \Exception("El modelo no tiene informacion para traduccion.");
     }
     $resultTranslation = \Service::get('database.manager')->model($this->propertiesInstance['model_translation'])->select('a.*, b.code')->innerJoin($this->propertiesInstance['model_language'], 'b')->where('a.translatable_id', '=', $result->{$primary})->get();
     foreach ($resultTranslation as $trans) {
         $code = $trans->code;
         unset($trans->code);
         $result->Translations[$code] = $trans;
     }
     return $result;
 }
开发者ID:kodazzi,项目名称:framework,代码行数:18,代码来源:Model.php

示例14: prepareSettings

 public static function prepareSettings()
 {
     $prepare = array();
     $settings = \Service::get('db')->model(self::$model)->fetchAll();
     foreach ($settings as $setting) {
         $value = null;
         if ($setting->type == 'integer') {
             $value = (int) $setting->content;
         } else {
             if ($setting->type == 'boolean') {
                 $value = $setting->content == 1 || $setting->content == 'true' ? true : false;
             } else {
                 $value = $setting->content;
             }
         }
         $prepare[$setting->label] = $value;
     }
     return $prepare;
 }
开发者ID:kodazzi,项目名称:amazonas,代码行数:19,代码来源:SettingsService.php

示例15: updateAction

 public function updateAction()
 {
     if (!Service::get('request')->isPost()) {
         throw new \Exception('Hack attempt');
     }
     if (!Service::get('security')->isAuthenticated()) {
         return $this->redirect('login', 'Please Login');
     }
     $errors = [];
     $userId = (int) $this->getRequest()->post('id');
     try {
         User::where(['id' => $userId])->update(['email' => $this->getRequest()->post('email'), 'password' => $this->getRequest()->post('password')]);
     } catch (DatabaseException $e) {
         $errors[] = $e->getMessage();
     }
     $userId = Service::get('security')->getUser()->id;
     $user = User::find((int) $userId);
     Service::get('security')->setUser($user);
     return $this->render('profile.html', ['user' => $user, 'action' => $this->generateRoute('update_profile'), 'errors' => isset($errors) ? $errors : null]);
 }
开发者ID:Insidexa,项目名称:Framework,代码行数:20,代码来源:ProfileController.php


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