草庐IT

Doctrine_Core

全部标签

php - 找不到类 'Doctrine_Record'

这重新开始here当我收到Class'Classname_model'notfound时。我通过显式调用该类解决了这个问题。然而,它暴露了另一个问题:Fatalerror:Class'Doctrine_Record'notfoundin/../application/models/classname_model.phponline7这是第7行:classClassname_modelextendsDoctrine_Record{现在,我在Doctrine、CodeIgniter和所有OOP/MVC方面都非常陌生。我的Doctrine安装或配置可能有问题吗?

php - Codeigniter 2 中的服务层与 Doctrine 2

希望你们中的一些人能帮助我。我在一个使用Codeigniter2和Doctrine2的项目中工作,一切正常,但我有一些“理智”问题我想解决。我现在遇到的主要问题是持久化实体。在普通的MVC中,持久性应该在模型中,但现在我只有实体和存储库,我没有所谓的“模型”,我将所有这些代码放在Controller中,使它们变得庞大而令人生畏:(我在一些地方读到,最好的方法是在Controller和实体之间有一个“服务”层,但我还没有在Codeigniter中找到一个好的方法来做到这一点,因为它很难经典MVC模式。所以我想就如何解决这个问题寻求一些建议。你们有没有遇到同样的问题?

php - 使用复合键的 Doctrine 2 Hydration

我有3个实体:1./***@ORM\Entity*/classProduct{/***@ORM\Id*@ORM\Column(type="integer",name="uid")*@ORM\GeneratedValue(strategy="AUTO")*/protected$id;/***@ORM\OneToMany(targetEntity="ProductLabel",mappedBy="product")*/protected$labels;publicfunction__construct(){$this->labels=newArrayCollection();}public

php - Doctrine2 从特征中复制属性和方法

我有一个实体,我想在其中使用特征“TimestampableEntity”来映射一些属性:namespaceWbudowie\PortalBundle\Entity;useDoctrine\ORM\MappingasORM;useGedmo\Mapping\AnnotationasGedmo;useWbudowie\PortalBundle\Traits\TimestampableEntity;/***Category**@Gedmo\Tree(type="materializedPath")*@Gedmo\SoftDeleteable(fieldName="deletedAt",ti

php - Symfony2 和 Doctrine2 : how to get all tags for a post?

在我的项目中,我在两个实体之间建立了多对多关系:Post和Tag。(帖子有一个变量“标签”)。我想允许用户通过他们的名字或他们的标签搜索帖子(例如在tumblr上)假设我的数据库中有这个:NameTagspost1:"Recipewitheggs"cooking,chicken,eggpost2:"RandomTitle"beef,chicken,eggpost3:"CookingFish"fish,cookingpost4:"Riceandchicken"rice,meat因此,如果我在搜索表单中输入“鸡蛋”,我必须只返回post1(因为标签)、post2(因为标签)和post4(因

php - 如何用预言测试 Doctrine Entity Manager findOneById 方法?

我正在使用预言来编写我的单元测试"require":{...,"phpspec/prophecy-phpunit":"~1.0"},我调用$dbUser=$this->em->getRepository('MainBundle:User')->findOneById($id);测试时出现错误,因为未定义findOneByProperty方法。除了将原始代码更改为:$dbUser=$this->em->getRepository('MainBundle:User')->findOneBy(array('id'=>$id);我没有找到任何其他解决方法。有什么方法可以使用预言并保留原始代码来

php - Symfony Doctrine 存储库 (findOneBy) 结果不是对象

我尝试理解Doctrine方面的一些奇怪行为,例如:我有一个简单的表单,并在最后创建表单的请求中发送参数。/***DisplaysaformtocreateanewCommententity.**@Route("/saveComment/",name="comment_new")*@Method("POST")*@Template()*/publicfunctionnewAction(Request$request){$entity=newComment();$form=$this->createCreateForm($entity,$request);returnarray('ent

php - Zend framework 2/Doctrine 2/批量操作和事件触发

对于一个包含很多实体的大型项目,我编写了一个save()通用方法。此方法存储在抽象服务中,并在所有项目中用于保存实体状态。AbstractService::save()看起来像这样:publicfunctionsave($entity){$transactionStarted=$this->beginTransaction();try{$action=$entity->getId()?self::UPDATE:self::CREATION;$this->getEventManager()->trigger('save.pre',$entity,['action'=>$action]);

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 - 序列化时,Doctrine oneToMany 关系导致反向实体上的外键为 null

Relevantinformation:I'musingSymfony2.8.x,Doctrine2.4.8andJMSSerializerBundle1.0.一个Resource可以有很多Experiences。我正在进行API调用以检索Resource和所有关联的Experience。但是,我返回的JSON在Experience实体的$resource上包含一个null。我正在使用以下方法来检索Resource:$this->findBy([],[],$limit,$offset);我不认为这应该是一个问题,因为我已经尝试直接在注释中将获取模式设置为EAGER-这仍然没有奏效。我还