草庐IT

Doctrine_Record

全部标签

mongodb - 如何使用 Symfony2 和 Doctrine 配置 Monolog 将日志存储到 MongoDB

能否获得一个完整示例,说明如何使用Symfony2.6和Doctrine2配置Monolog以将其日志存储到MongoDB中? 最佳答案 完整配置/app/parameters.ymlmongodb_server:"mongodb://localhost:27017"mongodb_username:"vagrant"mongodb_password:"password"mongodb_database:"testdb"/app/config.yml#Doctrine2MongoDBBundle#http://symfony.com

php - 如何正确地自动加载 Doctrine ODM 注释?

尝试运行命令行工具w/odm:schema:create和我收到如下错误:"[SemanticalError]Theannotation"@Document"inclassCompany_Model_Authwasneverimported.Didyoumaybeforgettoadda"use"statementforthisannotation?"and"[SemanticalError]Theannotation"@EmbeddedDocument"inclassCompany_Model_Authwasneverimported.Didyoumaybeforgettoadda"

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