草庐IT

doctrine

全部标签

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 - 无法在 symfony2 控制台命令中保留对象

我制作了一个简单的symfony2控制台脚本,用于将数据从旧模型转换为新模型。这是它的样子:classConvertScreenshotsCommandextendsCommand{[...]protectedfunctionexecute(InputInterface$input,OutputInterface$output){$em=$this->getContainer()->get('doctrine')->getManager();$output->writeln('Conversionstartedon'.date(DATE_RSS)."");$output->writel

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 - Symfony 2 实体字段属性

我的表单中有一个实体字段。该字段如下所示:->add('user','entity',array('class'=>'Elearning\SiteBundle\Entity\User','property'=>'name','multiple'=>true,'expanded'=>true,'required'=>true,'label'=>'Użytkownicy','attr'=>array('class'=>'userFiledCollection'),//thisnotworking.Itsetclasstoparentdiv.Iwanttohavethisclassinche

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 - 手动编写 DQL

我正在DoctrineDocumentation中尝试这部分其中你可以:手动编写DQL对于您这些SQL爱好者,我们没有忘记您。您可以选择手动编写DQL查询并将它们解析为Doctrine_Query实例或直接执行它们。$dql="FROMUseru,u.Phonenumbersp";$q=Doctrine_Query::create()->parseQuery($dql);或者你可以使用Doctrine_Query的query()方法来执行它们。$dql="FROMUseru,u.Phonenumbersp";$q=Doctrine_Query::create()->query($dql

php - 如何在 2 个不同的表中提交表单值 symfony

我想提交一个表单并将值存储在2个不同的表中(在同一个数据库中)。这是表格:Naam{{form_widget(form.product)}}{{form_errors(form.product)}}Aantal{{form_widget(form.amount)}}{{form_errors(form.amount)}}这是表单生成器:$builder->add("amount","number",array("label"=>"Aantal"));$builder->add("product","text",array("attr"=>array("autocomplete"=>"o