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


PHP Controller::get方法代码示例

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


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

示例1: __construct

 public function __construct(Controller $controller, $parametres = null)
 {
     $this->controller = $controller;
     $this->securityContext = $controller->get('security.context');
     $this->pageweb = $controller->get('aetools.pageweb');
     if ($parametres === null) {
         $parametres = array();
     }
     $this->parametres = $parametres;
 }
开发者ID:manu7772,项目名称:adaje_haltegarderie,代码行数:10,代码来源:pagewebType.php

示例2: createRosaceWind

 /**
  * @param Spot $spot spot contenant les orientation de vent
  * Créer une image png de la rosace des vents, avec GD.
  * L'image sera stockée dans :  images/windRosaces/spotId.png
  */
 static function createRosaceWind(Spot $spot, Controller $controller)
 {
     try {
         $rosaceImg = RosaceWindManage::createImageRosaceWind($spot);
         $ds = DIRECTORY_SEPARATOR;
         $urlImage = $controller->get("kernel")->getRootDir() . $ds . '..' . $ds . 'web' . $ds . 'images' . $ds . 'windRosaces';
         RosaceWindManage::createRoute($urlImage);
         $urlImageMin = $urlImage . $ds . $spot->getId() . ".min.png";
         $urlImage = $urlImage . $ds . $spot->getId() . ".png";
         $rosaceImgMin = imagecreate(LargeurImg * ScalledImgMin, HauteurImg * ScalledImgMin);
         $blanc = imagecolorallocate($rosaceImgMin, 255, 255, 255);
         imagecopyresampled($rosaceImgMin, $rosaceImg, 0, 0, 0, 0, LargeurImg * ScalledImgMin, HauteurImg * ScalledImgMin, LargeurImg, HauteurImg);
         imagecolortransparent($rosaceImgMin, $blanc);
         imagepng($rosaceImg, $urlImage);
         // on enregistre l'image dans le dossier "images/windRosaces"
         imagepng($rosaceImgMin, $urlImageMin);
         // on enregistre l'image dans le dossier "images/windRosaces"
         imagedestroy($rosaceImg);
         // libération de l'espace mémoire utilisé
         imagedestroy($rosaceImgMin);
     } catch (\Exception $e) {
         $toto = $e->getMessage();
         // pour debug
     }
 }
开发者ID:lapoiz,项目名称:WindServer2,代码行数:30,代码来源:RosaceWindManage.php

示例3: get

 /**
  * @param string $id Service name/id
  *
  * @return object
  */
 public function get($id)
 {
     if (!isset($this->loadedServices[$id])) {
         $this->loadedServices[$id] = parent::get($id);
     }
     return $this->loadedServices[$id];
 }
开发者ID:trivialsense,项目名称:php-framework-common,代码行数:12,代码来源:AbstractController.php

示例4: emergency

 public static function emergency(Controller $controller, $object, $text = '', $mode = 0)
 {
     $message = self::getMessage($object, $text, $mode);
     $logger = $controller->get('logger');
     /* @var $logger \Symfony\Bridge\Monolog\Logger */
     $pre = Debug::typeof($object, true);
     $logger->emerg("{$pre} | {$message}");
 }
开发者ID:ephp,项目名称:utility,代码行数:8,代码来源:Log.php

示例5: onController

 public function onController(Controller $controller, Request $request)
 {
     $repos = $this->admin->getRepository();
     $dql = $this->admin->getListDQL();
     $em = $this->admin->getManager();
     $query = $em->createQuery($dql);
     $paginator = $this->admin->getService('knp_paginator');
     $pagination = $paginator->paginate($query, $this->page_number, 10, array('pageParameterName' => 'admin_list_page'));
     return $controller->render($this->template, array('sf_admin_loader' => $controller->get('sf.admin.loader'), 'admin' => $this->admin, 'action' => $this, 'pagination' => $pagination));
 }
开发者ID:symforce,项目名称:symforce-admin,代码行数:10,代码来源:ListActionCache.php

示例6: onController

 public function onController(Controller $controller, Request $request)
 {
     $object = $this->admin->getRouteObject();
     $label = null;
     if ($this->admin->tree && $this->admin->getTreeObjectId()) {
         $label = $this->admin->trans('sf.tree.create.title', array('%object%' => $this->admin->string($this->admin->getTreeObject()), '%admin%' => $this->admin->getLabel()), $this->sf_domain);
     } else {
         $label = $this->admin->getFormLabel();
     }
     return $controller->render($this->template, array('sf_admin_loader' => $controller->get('sf.admin.loader'), 'admin' => $this->admin, 'action' => $this, 'object' => $object, 'title' => $label));
 }
开发者ID:symforce,项目名称:symforce-admin,代码行数:11,代码来源:ViewActionCache.php

示例7: createPaginators

 /**
  * Esta funcion permite instanciar un nuevo paginador para los listados
  * de la aplicacion, seteando los valores por defecto o parametrizados
  * por el usuario
  * @author Cesar Giraldo <cesargiraldo1108@gmail.com> 27/08/2015
  * @param \Symfony\Bundle\FrameworkBundle\Controller\Controller $controller
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @return \Ideup\SimplePaginatorBundle\Paginator\Paginator instancia del paginador
  */
 public static function createPaginators($controller, $request, array $ids)
 {
     $paginator = $controller->get('ideup.simple_paginator');
     $paginator->pageRanges = Paginator::$defaultPageRanges;
     foreach ($ids as $id) {
         $paginator->setItemsPerPage($request->get('itemsPerPage') != '' ? $request->get('itemsPerPage') : Paginator::$defaultItemsPerPage, $id);
         if ($paginator->getItemsPerPage($id) == 0) {
             $paginator->setItemsPerPage(Paginator::$defaultPageRanges[count(Paginator::$defaultPageRanges) - 1], $id);
         }
         $paginator->setMaxPagerItems(Paginator::$defaultMaxPagerItems, $id);
     }
     return $paginator;
 }
开发者ID:cesar-giraldo,项目名称:agile-scrum,代码行数:22,代码来源:Paginator.php

示例8: bundleInstalled

 /**
  * Checks if bundle with given name is installed.
  *
  * @param \Symfony\Bundle\FrameworkBundle\Controller\Controller $controller
  * @param string $bundleName Bundle name to search for
  *
  * @internal param array $bundles All bundles
  * @return bool Returns TRUE if we found bundle; otherwise FALSE
  */
 public static function bundleInstalled(Controller $controller, $bundleName)
 {
     $allBundles = $controller->get('kernel')->getBundles();
     $installed = false;
     if (!is_array($allBundles)) {
         return $installed;
     }
     foreach ($allBundles as $key => $bundle) {
         if ($bundle instanceof BundleInterface) {
             $name = $bundle->getName();
             if ($bundleName === $name) {
                 $installed = true;
                 break;
             }
         }
     }
     return $installed;
 }
开发者ID:rgies,项目名称:gui-bundle,代码行数:27,代码来源:BundleUtil.php

示例9: onController

 public function onController(Controller $controller, Request $request)
 {
     $object = $this->admin->getRouteObject();
     $list_url = $this->admin->path('list');
     if (!$object) {
         $request->getSession()->getFlashBag()->add('error', 'not exists!');
         return $controller->redirect($this->admin->path('list'));
     }
     $admin_children = array();
     $children = $this->admin->getAdminRouteChildren();
     if ($children) {
         foreach ($children as $child_admin_name => $o) {
             if ($o[0]) {
                 throw new \Exception("unimplement");
             }
             $admin_children[$child_admin_name] = array();
             $child_admin = $this->admin->getAdminLoader()->getAdminByName($child_admin_name);
             $properties = $o[0] ? $o[1] : array($o[1]);
             foreach ($properties as $config) {
                 $child_property = $config[0];
                 $my_property = $config[1];
                 $count = $child_admin->countBy($child_property, $object);
                 $admin_children[$child_admin_name][$child_property] = $count;
             }
         }
     }
     /**
      * @var \Symfony\Component\Form\FormBuilder
      */
     $builder = $controller->createFormBuilder($object, array('label' => $this->admin->getFormLabel(), 'constraints' => array(new \Symfony\Component\Validator\Constraints\Callback(function ($object, \Symfony\Component\Validator\Context\ExecutionContext $context) use($controller, $admin_children) {
         foreach ($admin_children as $child_admin_name => $list) {
             $child_admin = $this->admin->getAdminLoader()->getAdminByName($child_admin_name);
             foreach ($list as $count) {
                 if ($count > 0) {
                     if (!$child_admin->auth('delete')) {
                         $error = $this->admin->trans('sf.action.delete.error.child', array('%admin%' => $this->admin->getLabel(), '%child%' => $child_admin->getLabel(), '%count%' => $count), $this->sf_domain);
                         $context->addViolation($error);
                     }
                 }
             }
         }
     }))));
     $this->buildFormReferer($request, $builder, $object, $list_url);
     $form = $builder->getForm();
     $this->setForm($form);
     $dispatcher = $this->admin->getService('event_dispatcher');
     $event = new \Symforce\AdminBundle\Event\FormEvent($form, $request);
     $dispatcher->dispatch('sf.event.form', $event);
     if (null !== $event->getResponse()) {
         return $event->getResponse();
     }
     if ($request->isMethod('POST')) {
         $form->bind($request);
         $this->admin->fireEvent('submit', $form);
         if ($form->isValid()) {
             $msg = $this->trans('sf.action.delete.finish', $object);
             $this->admin->remove($object);
             $request->getSession()->getFlashBag()->add('info', $msg);
             return $controller->redirect($this->getFormReferer($form));
         }
     }
     return $controller->render($this->template, array('sf_admin_loader' => $controller->get('sf.admin.loader'), 'admin' => $this->admin, 'action' => $this, 'form' => $form->createView()));
 }
开发者ID:symforce,项目名称:symforce-admin,代码行数:63,代码来源:DeleteActionCache.php

示例10: get

 public function get($id)
 {
     return parent::get($id);
 }
开发者ID:zyxist,项目名称:cantiga,代码行数:4,代码来源:CantigaController.php


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