草庐IT

symfony-components

全部标签

php - Symfony2 和 Assetic - cssrewrite 非常适用于开发,不适用于产品

我将我的CSS包含在以下代码中:{%stylesheets'bundles/majorproductionssewingdivasite/css/*.css'filter='cssrewrite'%}{%endstylesheets%}在开发中,这让我可以毫无问题地使用图像Sprite。我的Sprite的结果URL是:http://localhost/diva/web/bundles/majorproductionssewingdivasite/images/diva-sprites.jpg但是,在产品中,它被映射到:http://localhost/diva/bundles/majo

php - symfony2 - 从数据库中添加选项

我希望用来自自定义查询的值填充symfony2中的选择框。我尽量简化了。ControllerclassPageControllerextendsController{publicfunctionindexAction(){$fields=$this->get('fields');$countries=$fields->getCountries();//returnsaarrayofcountriese.g.array('UK','France','etc')$routeSetup=newRouteSetup();//thisistheentity$routeSetup->setCoun

php - Symfony2 - 没有为约束配置默认选项

我正在学习Symfony2的教程书。我正在用表格做项目。第12章:表单|150我的代码:publicfunctionnewAction(Request$request){$task=newTask();$task->setTask('FindEiMgroup');$task->setDueDate(newDateTime('tomorrow'));$form=$this->createFormBuilder($task)->add('task','text')->add('dueDate','date')->add('save','submit')->getForm();return$

php - 当我在路由上有 post 方法时出现 Symfony\Component\HttpKernel\Exception\HttpException 错误

我正在使用jquery执行ajax请求,我想将一个数据发送到服务器(单击按钮的ID),以便我可以进行正确的查询并返回正确的响应。这个想法是,在我单击一个按钮后,我应该进行ajax调用以请求一个数据表。我的jquery函数如下所示:$('button').click(function(){vardep_id=$(this).attr('id');vartable=$('#dataTable').DataTable({"processing":true,"serverSide":true,"ajax":{"url":'{!!route('workerDepData')!!}',"type"

php - $this->render 和 $this->redirect 之间的区别 Symfony2

$this->render和$this->redirect有什么区别。有没有一种方法可以像$this->redirect那样用$this->render传递参数return$this->render('MedicineUserBundle:User:home.html.twig',array('info'=>$all,));我可以做这样的事情吗:-return$this->redirect($this->generateUrl('MedicineUserBundle_login',array('info'=>$all,)));或者有没有其他方法可以通过$this->redirect将值

php - Symfony 3.4 在我的包中使用 View

我在使用Symfony3.4配置新存储库时遇到了一些麻烦。我使用symfony命令在上一个LTS(3.4)中创建了他,我也使用命令添加了一个新的Bundle。我的新Bundle已启动并且运行良好,但我无法使用存储在该bundle中的View。我向您展示了我的Bundle的结构:我想像这样在我的Controller中使用这个index.html.twig:render('ListerListerBundle:Default:index.html.twig');}}但是当我尝试渲染它时出现了这个错误。Unabletofindtemplate"ListerListerBundle:Defau

php - 我应该在 Symfony 2 中的什么地方放置通用库代码?

快速提问:我应该将与ControllerUtilitiesServiceClass具有相似特征的代码放在哪里,正如BenjaminEberlei(http://www.whitewashing.de/2013/06/27/extending_symfony2__controller_utilities.html)在这篇博文中所描述的那样?暂时,我把它放在了:src/ProjectName/Library上下文我注意到了以下几点:此逻辑不属于特定的bundle,事实上它适用于将要创建的所有bundle。此逻辑通常属于特定于应用程序的库,而不是作为bundle的一部分,因为bundle内的

PhpStorm Symfony 分析器

如何让symfonyprofiler在phpstorm中工作?它应该在状态栏中,但是当我打开那个窗口时,它总是说:“这里什么都没有”。缓存目录在配置中正确定义,symfony插件本身工作正常。但是探查器从不显示信息。PhpStorm:8.0.3,Symfony插件:0.11.92 最佳答案 Profiler记录会自动从您的缓存中获取(即从app/cache/dev/profiler/index.csv)。确保您在dev环境中运行服务器。配置文件仅在开发模式下收集检查您的本地代码中是否存在该文件。你在你的phpstorm代码所在的同一

php - symfony: Autowiring 接口(interface)

我需要做什么才能完成这项工作?interfaceBaseServiceInterface{publicfunctiongetRecords();}classBaseServiceimplementsBaseServiceInterface{publicfunctiongetRecords(){return"bla";}}classSomeOtherService{private$baseService;publicfunction__construct(BaseServiceInterface$baseService){$this->baseService=$baseService;}

php - Symfony2 和 Doctrine2 : populate form with two Entity (a complicated scenario)

我有5个实体:用户,个人,用户隶属关系,PersonAffiliation和从属关系这是架构:一些细节:WebUser是在网站上注册的人。对于每个网络用户,都有一个人ID。一个人可以是网络用户、作者等。每个WebUser都有0个或多个从属关系。这些从属关系是由该WebUser创建的,并链接到可用的UserAffiliations中。WebUser还可以将他创建的从属关系链接到某个人(如果此人是作者),然后实体PersonAffiliation将被填充。我现在正在尝试让网络用户有可能将隶属关系分配给作者(人)。为此,我有:实体Person中@ORM\OneToMany(targetEnt