草庐IT

doctrine_registry

全部标签

php - Symfony2 Doctrine 遍历 while next()

我正在寻找一个可行的解决方案,以遍历mongodbsymfony2中的PersistentCollection.不幸的是,这似乎不起作用?Symfony忽略next()函数!while(($animal=$zooAnimals->next())!==false){$color=$animal->getColor();print_r($color);die;//Testanddie}print_r('Wherearetheanimals?');die;//引用:Doctrine\ODM\MongoDB\PersistentCollection 最佳答案

mongodb - 如何注释 Doctrine MongoDB 中的子文档?

我想实现应该模拟以下内容的php类:(Symfony,DoctrineMongoDBBundle)NotificationCollection{from{id,fname},to,sentDate}MemberCollection{id,fname,lname,email,phone,regDate,...}我想告诉ODM:“from字段是一个对象,它只包含2个值,发件人的id和他的fname”我必须使用什么注解?我应该定义另一个类,比如from.php吗?或者我可以创建两个类如下:/**@Document*/classNotification{/**@Id*/protected$id

mongodb - 如何配置灵 active 以使用 Doctrine 的 MongoDB ODM?

我正在尝试将apigility与doctrine的mongodbodm结合使用。我已经设置了我的文档并配置了doctrine模块。我已经(手动)向mongo插入了一个文档,并定义了一个基于代码的rest服务,使用它的“fetch”方法(在资源类中)返回文档存储库的“find”返回值。当我调用端点(没有ID)时,我得到了一个我插入的单个文档的数组,但它没有正确显示:{"_links":{"self":{"href":"http://localhost:8888/posts"}},"_embedded":{"posts":[{"\u0000MyApp\\Document\\Post\u00

php - 如何在 Zend Framework2 上使用 PHP 通过 Doctrine 2 ODM 在 MongoDB 中执行查询?

I'veattachedsamplecodehere.Thequeryreturnstheentiredb'smappinginsteadofthedatabeingqueriedfor,oranerrorwiththeAbstract-Hydratorclass.Here'sthecodeforthemapper:-postTitle=$postTitle;}/***@paramfield_type$postTitle*/publicfunctiongetPostTitle(){return$this->postTitle;}}?>Andhere'sthecodeforcontrol

mongodb - 坚持一对多 Doctrine Mongodb

我在我的项目中使用doctrineMongoDb。我有两个文档:Question和QuizzPart。QuizzPart引用了很多问题,为此我做了如下声明:/***@varArrayCollection*@MongoDB\ReferenceMany(targetDocument="Question",cascade={"all"})*/protected$questions=array();并且该问题引用了一个QuizzPart。/***@MongoDB\ReferenceOne(targetDocument="QuizzPart",inversedBy="questions")*/p

php - 克隆不能处理 zf2 Doctrine MongoOSEModule 中的嵌入式文档

这是我的文档/**@ODM\Field(type="string")*/private$Name;/**@ODM\Field(type="string")*/private$NormalizedName;/**@ODM\EmbedMany(targetDocument="BaselineBudget\Document\BaselineBudgetItems")*/private$BaselineBudgetItems=array();private$BaselineBudgetItems=array();我的克隆代码$data=$BaselineBudgetModel->findByI

mongodb - 如何使用 mongodb 从 doctrine ODM 中的引用文档数组中删除文档

我有一个php对象映射到具有结构的mongodb文档(称为Node)useDoctrine\ODM\MongoDB\Mapping\AnnotationsasMongoDB;classNode{/***@MongoDB\Id*/protected$id;/***@MongoDB\String*/protected$domain;/***@MongoDB\ReferenceMany(targetDocument="NodeItem",cascade=*{"persist"},simple="true")*/protected$items=array();//getterandsetter

php - 无法使用 Composer 安装 doctrine/mongodb-odm

尝试通过Composer安装doctrine/mongodb-odm我得到了这个:LoadingcomposerrepositorieswithpackageinformationUpdatingdependencies(includingrequire-dev)Yourrequirementscouldnotberesolvedtoaninstallablesetofpackages.Problem1-doctrine/mongodb1.0.x-devrequiresext-mongo>=1.2.12,therequestedPHPextensionmongoismissingfro

mongodb - 当 child 是拥有方时,Doctrine Mongo 级联删除 child

我有一个父/子OneToMany引用:/***@ODM\Document*/classParent{//.../***@var\Doctrine\Common\Collections\ArrayCollection*@ODM\ReferenceMany(targetDocument="Child",mappedBy="parent")*/protected$children;//...}/***@ODM\Document*/classChild{//.../***@varParent*@ODM\ReferenceOne(targetDocument="Parent",inversedB

mongodb - Doctrine ODM 节省大量资金

这可能是一个愚蠢的问题,但我正在努力在mongoDB文档中保存一个大数字。基本上,我想保存一个可以大于maxint值的数字。因此,我将我的文档字段声明为@Field(type="float")。现在的问题是保存数字会导致错误。我也试过简单地使用@Integer但数字减少到2147483647(这是32位系统的最大int值)。所以我尝试了最后一个解决方案,将我的号码保存在一个字符串中。这工作正常(至少它在数据库中看起来是正确的),但返回文档并执行echo$number返回2147483647。有人解决这个问题吗?我做错了什么? 最佳答案