草庐IT

settings-bundle

全部标签

php - Doctrine: No alias was set before invoking getRootAlias() 错误

我的原始查询是:Select*fromuseruinnerjoincompanyconu.company_id=c.idwhereu.id=2我把它变成了:$em=$this->get('doctrine')->getEntityManager();$qb=$em->createQueryBuilder();$qb->select('u')->from('TemplateManager\Bundle\DocumentGeneratorBundle\Entity\Useru')->innerjoin('u.company')->where('u.id='.$id);$query=$qb-

php - Symfony 和 Willdurand/Hateoas Bundle - JSON 响应上没有链接

我正在使用FOSRest和Willdurand/Hateoasbundle。我遵循以下示例https://github.com/willdurand/Hateoas#configuring-links但JSON响应中没有“链接”字段。/***Users**@ORM\Table(name="users")*@ORM\Entity*@Serializer\ExclusionPolicy("ALL")*@Hateoas\Relation("self",href="expr('/users'~object.getId())")*/classUser{/***@varinteger**@ORM\

PHP/ Apache : Permission settings for uploaded JPEG image files not correct

我刚刚设置了一个LAMP开发服务器,并且仍在解决一些问题。服务器安装在一台计算机上,我使用Windows笔记本电脑编写代码并通过网络浏览器测试站点。我的文件上传脚本的工作原理是JPEG图像文件已成功上传到服务器,但是当我尝试在网络浏览器中查看图像时,权限被拒绝。我通过服务器检查文件的权限,它们是600。我可以通过chmod777theimage.jpg解决这个问题,但这似乎根本不是一个好的解决方案。该解决方案是否与Apache配置有关?或者还有什么我应该做的。谢谢,迈克更新澄清一下,我可以将JPEG文件上传到/var/www/test/images,但上传后无法在Web浏览器中查看图像

php - Zend 框架 : Setting decorators and labels - should this be done in the view or the form class?

我注意到许多(大多数?)人在使用ZendFramework时会在Form类本身中添加装饰器和标签。classUser_Form_AddextendsZend_Form{publicfunctioninit(){parent::init();$username=newZend_Form_Element_Text('username');$username->setLabel('Username:')->setRequired(true)->addFilter('StringTrim')->addValidator('StringLength',$breakChainOnFailure=f

php - Symfony2 bundle 与 PSR-0 兼容的第 3 方库之间有什么区别?

我知道一个包应该包含thebestpracticesdocumentation中概述的目录结构和其他约定。.我仍然不明白为什么我应该在Symfony2安装中选择将库作为bundle安装还是“按原样”安装PSR-0兼容库。例如,我想安装GuzzleHttpClient库。目前我有两个版本可供选择:libraryitself或Guzzle'bundle'.我可以看到包使用了库,但由于我是Symfony2的新手,所以我还不能掌握“大局”。有人可以帮帮我吗? 最佳答案 使用包而不是库将允许您从ServiceContainer访问库。这将使您

php - "Submitted form is invalid"将产品添加到购物车时 : Sylius Cart Bundle

如果这似乎是一个非常幼稚的问题,我深表歉意。但我刚刚学习了Symfony2并试图了解Sylius的工作原理。.当我将产品添加到购物车时,它似乎总是返回错误:Submittedformisinvalid我已经搜索了这个问题的解决方案,但似乎没有任何记录(或者我有没有错过了??)我也评论了验证部分,但仍然得到同样的错误。请帮助并提前致谢。 最佳答案 这与产品的选项有关。我有同样的错误,通过探查器查看Doctrine信息,有2个对象存在错误,这些对象被持久化到数据库中。具体来说,它无法映射Sylius\Bundle\AssortmentB

php - 错误 : You must use the "set" method to update an entry fix?

我使用codeigniter作为我的PHP框架,当我提交我的fromtopost到我的数据库时,我总是收到这个错误。Youmustusethe"set"methodtoupdateanentry我不太确定这是什么意思,从我看过的其他帖子来看,每个人都说数据映射器需要为对象分配一个值。由于我是新手,有人可以给我更好的解释吗。这是我的代码,它说我有错误:classAdd_bookextendsCI_Model{publicfunctionadd_book($data){$this->db->insert('ST_ITM',$data);}}?>谢谢。 最佳答案

在 bundle 扩展加载时找不到 PHP Symfony 请求堆栈

我正在尝试创建可重用的日志记录包,它可以为日志消息设置自定义格式化程序。格式化程序在主应用程序的配置文件中设置如下:custom_logger:formatter:AppBundle\Services\MessageFormatter然后在LoggerBundle/DependencyInjection/CustomLoggerExtension.php收到此配置后,我正在尝试获取记录器服务并设置格式化程序classCustomLoggerExtensionextendsConfigurableExtension{publicfunctionloadInternal(array$mer

php - 为 WooCommerce : Adding an option tab to API settings 创建插件

我正在为Worpdress/WooCommerce创建一个插件。我已经完成了所有的工作,现在我想在woocommerceAPI设置中添加一个选项卡,就像这样instructiontutorial.这是我的代码:add_filter('woocommerce_get_sections_api','some_function_to_add_tab');functionsome_function_to_add_tab($sections){$sections['some_settings']=__('SomeSettings','text-domain');return$sections;}

php - Symfony 3.3 从 3.2 : Compile Error: Cannot declare class Symfony\Bundle\SecurityBundle\Security\FirewallMap

自从我从symfony3.2更新到3.3后我遇到了一些问题,我得到了这个错误CompileError:CannotdeclareclassSymfony\Bundle\SecurityBundle\Security\FirewallMap,becausethenameisalreadyinuseinclasses.php(line1709)inClassCollectionLoader.php(line99)atClassCollectionLoader::load()inKernel.php(line428)atKernel->doLoadClassCache()inKernel.p