草庐IT

REPOSITORY

全部标签

php - 您是否将存储库注入(inject)域对象?

在每天学习10多个小时的领域驱动设计一周之后,我开始觉得我已经开始很好地理解它了,直到我今天读了这篇文章:http://blog.fedecarg.com/2009/03/15/domain-driven-design-the-repository/那篇文章的作者说你将Repository注入(inject)到Domain对象中,这对我来说没有任何意义。我不是这方面的专家,但我认为他是错的,但我想听听这里的一些人关于将存储库注入(inject)域对象是对还是错的一些意见。在我上周阅读的所有内容中,每天阅读另一篇文章和另一篇文章对我来说都是一样的(这是一件好事),直到我看到上面发布的文章

php - 类 App\Repositories\UserRepository 不存在

socialite=$socialite;$this->users=$users;$this->auth=$auth;}}这是我的Controller。当我加载这个Controller时,它显示了类似的错误"ReflectionExceptioninContainer.phpline791:ClassApp\Repositories\UserRepositorydoesnotexist".谁能给我一个解决方案? 最佳答案 可能是命名空间问题检查您的UserRepository文件类的路径。应该是:app/Repositories/U

php - Symfony/Doctrine - createQueryBuilder orderBy

我有一个“团队”实体,其属性为“预算”。我只想打印团队属性,我希望预算最高的团队出现在第一位、第二位、第三位...(DESC)。但是使用这段代码,它不起作用,我不明白为什么。indexAction(Controller)$em=$this->getDoctrine()->getManager();$teams=$em->getRepository('FootballBundle:Team')->getAllTeamsSortedByDescBudget();return$this->render('FootballBundle:Default:index.html.twig',arra

php - Symfony 2 Entity Repository find()返回空数组

谢谢大家从现在开始的回答。这就是问题所在。我有一个带有两个实体(任务和产品)的symfony2应用程序。当我尝试查找(findBy,findOneBy,findAll)产品时,它返回一个空数组。任务实体tasks=newArrayCollection();}/***Setproduct**@param\pablo\UserBundle\Entity\Product$product**@returnTask*/publicfunctionsetProduct(\pablo\UserBundle\Entity\Product$product=null){$this->product=$pr

php - 什么相当于在条令中编写任务的存储库?

作为APIofDoctrine说:AnEntityRepositoryservesasarepositoryforentitieswithgenericaswellasbusinessspecificmethodsforretrievingentities.Thisclassisdesignedforinheritanceanduserscansubclassthisclasstowritetheirownrepositorieswithbusiness-specificmethodstolocateentities.但是我的用于保存实体的业务逻辑的正确位置在哪里?将正确的构造函数放入

php - PHP 和 Laravel 中的接口(interface)和存储库命名

我在Laravel中使用存储库模式和接口(interface),发现命名很冗长:UserRepositoryInterface或EventRepositoryInterface。是否有其他更简洁的命名约定?我希望我的代码对future的程序员保持可读性。在DDD中,一些人建议将UserRepositoryInterface简单命名为Users或AllUsers,更多信息请参见:Howtonamerepositoryandserviceinterfaces?. 最佳答案 命名接口(interface)的“好”方法应该是UserRepo

php - SVN 存储库新手问题

我处于理解SVN存储库的早期阶段,我有几个问题:我应该将什么样的文件放入存储库?例如,我知道PHP、JS、FLA等...被接受为标准,但是像PSD(将来可能会更改)、AI(AdobeIllustrator文件)等...?我应该将它们保存在存储库中,还是只保存导出的版本?是否存在被认为“太大”而无法放入存储库的文件?例如,我有一个11mB的PSD。推荐的最大文件大小是多少?如果重要的话,我在我的环境中运行这个存储库,所以存储不是问题。:)感谢您的宝贵时间。 最佳答案 我会按顺序回答你的问题。您经常更改并希望备份的任何文件都适合放入SV

php - Symfony 2/存储库 : Error: __clone method called on non-object

我刚开始使用Symfony,但我不明白为什么在存储库中创建自定义函数时会出现此错误。我的实体Category.php:name;}/***Getid**@returninteger*/publicfunctiongetId(){return$this->id;}/***Setname**@paramstring$name*@returnCategory*/publicfunctionsetName($name){$this->name=$name;return$this;}/***Getname**@returnstring*/publicfunctiongetName(){retur

php - 交响乐 3.0 : Reuse entity in repository

在我的Symfony3.0项目中,我有一个名为ImageGroups的实体和一个使用ImageGroups实体的ImageGroupsRepository存储库。我还制作了一个带有ImagesRepository的Images实体在ImageGroupsRepository中,我有一个名为getUserImageGroups的方法,在ImagesRepository中,我有一个名为add的方法。我想问的是如何使用ImageGroupsRepository的getUserImageGroups方法到ImagesRepository的add? 最佳答案

php - Symfony2 : Using a repository in a command

我正在使用Symfony2(2.6),我想在名称为CRM:fetchEmails的命令中使用联系人实体的自定义存储库。我尝试了两种不同的方法来获取存储库:第一种方法:在我的命令文件的执行函数中$repository=$this->getContainer()->get('doctrine')->getEntityManager()->getRepository('CRMBundle:Contact');第二种方法:在我的命令文件的执行函数中$repository=$this->getContainer()->get('myrepository');在config.yml中myrepos