protected function prepare()
 {
     $this->_identifierMap = $this->_resultPointers = $this->_idTemplate = array();
     $this->_resultCounter = 0;
     $this->dtoMap = DtoClassMap::getMapDto();
     foreach ($this->_rsm->aliasMap as $dqlAlias => $className) {
         $this->_identifierMap[$dqlAlias] = array();
         $this->_idTemplate[$dqlAlias] = '';
         if (!isset($this->_ce[$className])) {
             $this->_ce[$className] = $this->_em->getClassMetadata($className);
         }
         // Remember which associations are "fetch joined", so that we know where to inject
         // collection stubs or proxies and where not.
         if (!isset($this->_rsm->relationMap[$dqlAlias])) {
             continue;
         }
         if (!isset($this->_rsm->aliasMap[$this->_rsm->parentAliasMap[$dqlAlias]])) {
             throw HydrationException::parentObjectOfRelationNotFound($dqlAlias, $this->_rsm->parentAliasMap[$dqlAlias]);
         }
         $sourceClassName = $this->_rsm->aliasMap[$this->_rsm->parentAliasMap[$dqlAlias]];
         $sourceClass = $this->_getClassMetadata($sourceClassName);
         $assoc = $sourceClass->associationMappings[$this->_rsm->relationMap[$dqlAlias]];
         $this->_hints['fetched'][$this->_rsm->parentAliasMap[$dqlAlias]][$assoc['fieldName']] = true;
         if ($assoc['type'] === ClassMetadata::MANY_TO_MANY) {
             continue;
         }
         // Mark any non-collection opposite sides as fetched, too.
         if ($assoc['mappedBy']) {
             $this->_hints['fetched'][$dqlAlias][$assoc['mappedBy']] = true;
             continue;
         }
         // handle fetch-joined owning side bi-directional one-to-one associations
         if ($assoc['inversedBy']) {
             $class = $this->_ce[$className];
             $inverseAssoc = $class->associationMappings[$assoc['inversedBy']];
             if (!($inverseAssoc['type'] & ClassMetadata::TO_ONE)) {
                 continue;
             }
             $this->_hints['fetched'][$dqlAlias][$inverseAssoc['fieldName']] = true;
         }
     }
 }
 public function boot()
 {
     $classMap = $this->container->getParameter('doctrine_dto.class_map');
     $mapGeneratorDto = $this->container->getParameter('doctrine_dto.map_generator_dto');
     $mapGeneratorEntity = $this->container->getParameter('doctrine_dto.map_generator_entity');
     $entityDtoMap = new Map();
     foreach ($classMap as $entityPath => $dtoPath) {
         $entityDtoMap->addMapElement($entityPath, $dtoPath);
     }
     foreach ($mapGeneratorDto as $classPath) {
         /** @var MapInterface $classPath */
         $object = new $classPath();
         $entityDtoMap->addMapGeneratorElement($object);
     }
     $dtoEntityMap = $entityDtoMap->getFlippedMap();
     foreach ($mapGeneratorEntity as $classPath) {
         /** @var MapInterface $classPath */
         $object = new $classPath();
         $dtoEntityMap->addMapGeneratorElement($object);
     }
     DtoClassMap::setMap($entityDtoMap, $dtoEntityMap);
 }
 public static function setUpBeforeClass()
 {
     $map = new Map(array(get_class(new UserEntity()) => get_class(new UserDto()), get_class(new PhoneEntity()) => get_class(new PhoneDto()), get_class(new CarEntity()) => get_class(new CarDto())));
     $map->addMapGeneratorElement(new EntityDtoSimpleGenerator());
     DtoClassMap::setMap($map, $map->getFlippedMap());
 }