草庐IT

symfony-components

全部标签

php - Symfony2 和 date_default_timezone_get() - 依赖系统的时区设置是不安全的

我有一个Symfony2项目。我今天将我的php更新到5.5.7,从那时起,我得到了Warning:date_default_timezone_get():Itisnotsafetorelyonthesystem'stimezonesettings.Youare*required*tousethedate.timezonesettingorthedate_default_timezone_set()function.Incaseyouusedanyofthosemethodsandyouarestillgettingthiswarning,youmostlikelymisspelled

java - 上下文中的多个包:component-scan, spring config

如何在context:component-scan元素的spring-servlet.xml文件中添加多个包?我试过了和和但出现错误:org.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[x.y.z.dao.daoservice.LoginDAO]foundfordependency: 最佳答案 以下做法是正确的:注意报错是x.y.z.dao.daoservice.LoginDAO,上面提到的包里没有,可能是你忘记加了

java - 上下文中的多个包:component-scan, spring config

如何在context:component-scan元素的spring-servlet.xml文件中添加多个包?我试过了和和但出现错误:org.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[x.y.z.dao.daoservice.LoginDAO]foundfordependency: 最佳答案 以下做法是正确的:注意报错是x.y.z.dao.daoservice.LoginDAO,上面提到的包里没有,可能是你忘记加了

php - 向 Symfony 2 表单元素添加错误

我在我的Controller中检查了一些验证。我想在失败时将错误添加到表单的特定元素。我的表格:useSymfony\Component\Form\FormError;//...$config=newConfig();$form=$this->createFormBuilder($config)->add('googleMapKey','text',array('label'=>'GoogleMapkey'))->add('locationRadius','text',array('label'=>'Locationradius(km)'))->getForm();//...$form

php - 向 Symfony 2 表单元素添加错误

我在我的Controller中检查了一些验证。我想在失败时将错误添加到表单的特定元素。我的表格:useSymfony\Component\Form\FormError;//...$config=newConfig();$form=$this->createFormBuilder($config)->add('googleMapKey','text',array('label'=>'GoogleMapkey'))->add('locationRadius','text',array('label'=>'Locationradius(km)'))->getForm();//...$form

php - 如何在 symfony2 Controller 中发送 JSON 响应

我正在使用jQuery来编辑我在Symfony中构建的表单。我在jQuery对话框中显示表单,然后提交它。数据在数据库中输入正确。但我不知道是否需要将一些JSON发送回jQuery。实际上我对JSON的事情有点困惑。假设我在我的表中添加了一行``jQuery并且当我提交表单时,在提交数据后我想发回那些行数据,以便我可以动态添加表行以显示添加的数据。我很困惑如何取回这些数据。这是我当前的代码:$editForm=$this->createForm(newStepsType(),$entity);$request=$this->getRequest();$editForm->bindReq

php - 如何在 symfony2 Controller 中发送 JSON 响应

我正在使用jQuery来编辑我在Symfony中构建的表单。我在jQuery对话框中显示表单,然后提交它。数据在数据库中输入正确。但我不知道是否需要将一些JSON发送回jQuery。实际上我对JSON的事情有点困惑。假设我在我的表中添加了一行``jQuery并且当我提交表单时,在提交数据后我想发回那些行数据,以便我可以动态添加表行以显示添加的数据。我很困惑如何取回这些数据。这是我当前的代码:$editForm=$this->createForm(newStepsType(),$entity);$request=$this->getRequest();$editForm->bindReq

php - 访问 Symfony2 请求对象中的 POST 值

好的,这是一个新手问题,但我无法在任何地方找到答案。在Symfony2的Controller中,我想从我的一个表单中访问POST值。在Controller中我有:publicfunctionindexAction(){$request=$this->get('request');if($request->getMethod()=='POST'){$form=$this->get('form.factory')->create(newContactType());$form->bindRequest($request);if($form->isValid()){$name_value=$

php - 访问 Symfony2 请求对象中的 POST 值

好的,这是一个新手问题,但我无法在任何地方找到答案。在Symfony2的Controller中,我想从我的一个表单中访问POST值。在Controller中我有:publicfunctionindexAction(){$request=$this->get('request');if($request->getMethod()=='POST'){$form=$this->get('form.factory')->create(newContactType());$form->bindRequest($request);if($form->isValid()){$name_value=$

php - symfony2 中的 var_dump 数据过多

我有大约40个实体和许多双向关系。每当我使用var_dump($user)或任何实体时,我的浏览器都会加载太多的数组和变量数据,然后它就崩溃了。我想知道什么问题。数据插入正常。我可以在生产中引起问题吗? 最佳答案 将var_dump()替换为调试方法dump()由DoctrineCommon提供.\Doctrine\Common\Util\Debug::dump($user);它适用于单个对象和Doctrine集合,应该可以防止浏览器显示您遇到的问题。 关于php-symfony2中的v