Skip to content

Instantly share code, notes, and snippets.

@webdevilopers
Last active Jan 29, 2018
Embed
What would you like to do?
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"provide": { "ext-mongo": "1.6.12" },
"require": {
"php": "^7.0",
"symfony/symfony": "2.8.10",
"doctrine/orm": "2.5.12",
"doctrine/annotations": "1.4.*",
"doctrine/dbal": "2.5.*",
"doctrine/doctrine-bundle": "1.6.6",
"doctrine/migrations": "^1.2",
"doctrine/doctrine-migrations-bundle": "dev-master#861d3564c03b3867845ffd87d9b19f49dc673c69",
"doctrine/data-fixtures": "1.1.1",
"doctrine/doctrine-fixtures-bundle": "v2.2.0",
"doctrine/mongodb": "1.6.1",
"doctrine/mongodb-odm": "^1.0.5",
"doctrine/mongodb-odm-bundle": "3.4.1",
"mongodb/mongodb": "1.1.2",
"alcaeus/mongo-php-adapter": "^1.0.0",
"stof/doctrine-extensions-bundle": "v1.1.0",
"knplabs/knp-paginator-bundle": "2.4.2",
"knplabs/knp-menu-bundle": "2.1.3",
"knplabs/knp-snappy-bundle": "1.5.2",
"knplabs/knp-snappy": "1.0.3",
"twig/extensions": "~1.0",
"data-uri/twig-extension": "1.0.1",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "2.6.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "1.3.6",
"sonata-project/admin-bundle": "3.3.1",
"sonata-project/block-bundle": "3.1.1",
"sonata-project/cache-bundle": "2.4.0",
"sonata-project/core-bundle": "3.0.3",
"sonata-project/easy-extends-bundle": "2.3.0",
"sonata-project/datagrid-bundle": "2.3.0",
"sonata-project/user-bundle": "3.0.1",
"sonata-project/doctrine-orm-admin-bundle": "3.0.4",
"sonata-project/intl-bundle": "2.4.0",
"sonata-project/media-bundle": "3.1.0",
"jms/serializer-bundle": "^1.0",
"genemu/form-bundle": "dev-master",
"mremi/contact-bundle": "1.3.0",
"craue/formflow-bundle": "2.1.8",
"simple-bus/message-bus": "~2.2",
"simple-bus/symfony-bridge": "^4.1",
"simple-bus/doctrine-orm-bridge": "^4.0",
"ocramius/proxy-manager": "2.0.*",
"zendframework/zend-code": "~3.0.2, !=3.0.3",
"happyr/doctrine-specification": "0.7.1",
"swiftmailer/swiftmailer": "5.4.8",
"guzzlehttp/guzzle": "6.*",
"php-amqplib/php-amqplib": "2.6.*",
"php-amqplib/rabbitmq-bundle": "1.14.2",
"phobetor/rabbitmq-supervisor-bundle": "~2.0",
"prooph/event-store": "6.6.1",
"prooph/service-bus-symfony-bundle": "^0.3.0",
"prooph/event-store-symfony-bundle": "v0.2.x",
"prooph/event-sourcing": "^4.0",
"prooph/event-store-doctrine-adapter": "^3.3",
"prooph/event-store-bus-bridge": "^2.0",
"ramsey/uuid": "~3.0",
"mattketmo/uuid-2x-bridge": "*@dev",
"react/promise" : "^2.5.1",
"webmozart/assert": "1.2.0"
},
"require-dev": {
"sensio/generator-bundle": "~2.3",
"phpunit/phpunit": "5.4.*"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\\Composer::hookRootPackageInstall"
],
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles"
]
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"psr-0": {
"": "src/",
"SymfonyStandard": "app/"
}
},
"autoload-dev": {
"files": [
"vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
],
"psr-4": { "Tests\\": "tests/" }
},
"config": {
"bin-dir": "bin"
},
"license": "MIT",
"type": "project"
}
<?php
/*
* @ORM\Entity()
*/
class Partner
{
/**
* @var PartnerOfferItem[] $offerItems
* @ORM\OneToMany(targetEntity="Sps\Bundle\BaseBundle\Entity\PartnerOfferItem", mappedBy="partner", indexBy="price_id", fetch="EAGER", orphanRemoval=true)
* @see http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/changelog/migration_2_5.html#improve-efficiency-of-one-to-many-eager
* @ORM\OrderBy({"position" = "ASC"})
*/
protected $offerItems;
}
<?php
/**
* @ORM\Entity()
*/
class PartnerOfferItem
{
/**
* @var Partner $partner
*
* @ORM\ManyToOne(targetEntity="Sps\Bundle\BaseBundle\Entity\Partner", inversedBy="offerItems")
*/
protected $partner;
}
@webdevilopers

This comment has been minimized.

Copy link
Owner Author

@webdevilopers webdevilopers commented Jan 29, 2018

According to @doctrine 2.5 the indexBy should work for OneToMany with EAGER:

Unfortunately it only works when removing fetch="eager".

Discussion on @twitter:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment