or on 3.0', __METHOD__, Result::class); $stmt = ForwardCompatibilityResult::ensure($stmt); } $this->_stmt = $stmt; $this->_rsm = $resultSetMapping; $this->_hints = $hints; $this->_em->getEventManager()->addEventListener([Events::onClear], $this); $this->prepare(); try { $result = $this->hydrateAllData(); } finally { $this->cleanup(); } return $result; } public function hydrateRow() { Deprecation::triggerIfCalledFromOutside('doctrine/orm', 'https://github.com/doctrine/orm/pull/9072', '%s is deprecated.', __METHOD__); $row = $this->statement()->fetchAssociative(); if ($row === \false) { $this->cleanup(); return \false; } $result = []; $this->hydrateRowData($row, $result); return $result; } public function onClear($eventArgs) { } protected function prepare() { } protected function cleanup() { $this->statement()->free(); $this->_stmt = null; $this->_rsm = null; $this->_cache = []; $this->_metadataCache = []; $this->_em->getEventManager()->removeEventListener([Events::onClear], $this); } protected function cleanupAfterRowIteration() : void { } protected function hydrateRowData(array $row, array &$result) { throw new HydrationException('hydrateRowData() not implemented by this hydrator.'); } protected abstract function hydrateAllData(); protected function gatherRowData(array $data, array &$id, array &$nonemptyComponents) { $rowData = ['data' => []]; foreach ($data as $key => $value) { $cacheKeyInfo = $this->hydrateColumnInfo($key); if ($cacheKeyInfo === null) { continue; } $fieldName = $cacheKeyInfo['fieldName']; switch (\true) { case isset($cacheKeyInfo['isNewObjectParameter']): $argIndex = $cacheKeyInfo['argIndex']; $objIndex = $cacheKeyInfo['objIndex']; $type = $cacheKeyInfo['type']; $value = $type->convertToPHPValue($value, $this->_platform); if ($value !== null && isset($cacheKeyInfo['enumType'])) { $value = $this->buildEnum($value, $cacheKeyInfo['enumType']); } $rowData['newObjects'][$objIndex]['class'] = $cacheKeyInfo['class']; $rowData['newObjects'][$objIndex]['args'][$argIndex] = $value; break; case isset($cacheKeyInfo['isScalar']): $type = $cacheKeyInfo['type']; $value = $type->convertToPHPValue($value, $this->_platform); if ($value !== null && isset($cacheKeyInfo['enumType'])) { $value = $this->buildEnum($value, $cacheKeyInfo['enumType']); } $rowData['scalars'][$fieldName] = $value; break; //case (isset($cacheKeyInfo['isMetaColumn'])): default: $dqlAlias = $cacheKeyInfo['dqlAlias']; $type = $cacheKeyInfo['type']; // If there are field name collisions in the child class, then we need // to only hydrate if we are looking at the correct discriminator value if (isset($cacheKeyInfo['discriminatorColumn'], $data[$cacheKeyInfo['discriminatorColumn']]) && !in_array((string) $data[$cacheKeyInfo['discriminatorColumn']], $cacheKeyInfo['discriminatorValues'], \true)) { break; } // in an inheritance hierarchy the same field could be defined several times. // We overwrite this value so long we don't have a non-null value, that value we keep. // Per definition it cannot be that a field is defined several times and has several values. if (isset($rowData['data'][$dqlAlias][$fieldName])) { break; } $rowData['data'][$dqlAlias][$fieldName] = $type ? $type->convertToPHPValue($value, $this->_platform) : $value; if ($rowData['data'][$dqlAlias][$fieldName] !== null && isset($cacheKeyInfo['enumType'])) { $rowData['data'][$dqlAlias][$fieldName] = $this->buildEnum($rowData['data'][$dqlAlias][$fieldName], $cacheKeyInfo['enumType']); } if ($cacheKeyInfo['isIdentifier'] && $value !== null) { $id[$dqlAlias] .= '|' . $value; $nonemptyComponents[$dqlAlias] = \true; } break; } } return $rowData; } protected function gatherScalarRowData(&$data) { $rowData = []; foreach ($data as $key => $value) { $cacheKeyInfo = $this->hydrateColumnInfo($key); if ($cacheKeyInfo === null) { continue; } $fieldName = $cacheKeyInfo['fieldName']; // WARNING: BC break! We know this is the desired behavior to type convert values, but this // erroneous behavior exists since 2.0 and we're forced to keep compatibility. if (!isset($cacheKeyInfo['isScalar'])) { $type = $cacheKeyInfo['type']; $value = $type ? $type->convertToPHPValue($value, $this->_platform) : $value; $fieldName = $cacheKeyInfo['dqlAlias'] . '_' . $fieldName; } $rowData[$fieldName] = $value; } return $rowData; } protected function hydrateColumnInfo($key) { if (isset($this->_cache[$key])) { return $this->_cache[$key]; } switch (\true) { // NOTE: Most of the times it's a field mapping, so keep it first!!! case isset($this->_rsm->fieldMappings[$key]): $classMetadata = $this->getClassMetadata($this->_rsm->declaringClasses[$key]); $fieldName = $this->_rsm->fieldMappings[$key]; $fieldMapping = $classMetadata->fieldMappings[$fieldName]; $ownerMap = $this->_rsm->columnOwnerMap[$key]; $columnInfo = ['isIdentifier' => in_array($fieldName, $classMetadata->identifier, \true), 'fieldName' => $fieldName, 'type' => Type::getType($fieldMapping['type']), 'dqlAlias' => $ownerMap, 'enumType' => $this->_rsm->enumMappings[$key] ?? null]; // the current discriminator value must be saved in order to disambiguate fields hydration, // should there be field name collisions if ($classMetadata->parentClasses && isset($this->_rsm->discriminatorColumns[$ownerMap])) { return $this->_cache[$key] = array_merge($columnInfo, ['discriminatorColumn' => $this->_rsm->discriminatorColumns[$ownerMap], 'discriminatorValue' => $classMetadata->discriminatorValue, 'discriminatorValues' => $this->getDiscriminatorValues($classMetadata)]); } return $this->_cache[$key] = $columnInfo; case isset($this->_rsm->newObjectMappings[$key]): // WARNING: A NEW object is also a scalar, so it must be declared before! $mapping = $this->_rsm->newObjectMappings[$key]; return $this->_cache[$key] = ['isScalar' => \true, 'isNewObjectParameter' => \true, 'fieldName' => $this->_rsm->scalarMappings[$key], 'type' => Type::getType($this->_rsm->typeMappings[$key]), 'argIndex' => $mapping['argIndex'], 'objIndex' => $mapping['objIndex'], 'class' => new ReflectionClass($mapping['className']), 'enumType' => $this->_rsm->enumMappings[$key] ?? null]; case isset($this->_rsm->scalarMappings[$key], $this->_hints[LimitSubqueryWalker::FORCE_DBAL_TYPE_CONVERSION]): return $this->_cache[$key] = ['fieldName' => $this->_rsm->scalarMappings[$key], 'type' => Type::getType($this->_rsm->typeMappings[$key]), 'dqlAlias' => '', 'enumType' => $this->_rsm->enumMappings[$key] ?? null]; case isset($this->_rsm->scalarMappings[$key]): return $this->_cache[$key] = ['isScalar' => \true, 'fieldName' => $this->_rsm->scalarMappings[$key], 'type' => Type::getType($this->_rsm->typeMappings[$key]), 'enumType' => $this->_rsm->enumMappings[$key] ?? null]; case isset($this->_rsm->metaMappings[$key]): // Meta column (has meaning in relational schema only, i.e. foreign keys or discriminator columns). $fieldName = $this->_rsm->metaMappings[$key]; $dqlAlias = $this->_rsm->columnOwnerMap[$key]; $type = isset($this->_rsm->typeMappings[$key]) ? Type::getType($this->_rsm->typeMappings[$key]) : null; // Cache metadata fetch $this->getClassMetadata($this->_rsm->aliasMap[$dqlAlias]); return $this->_cache[$key] = ['isIdentifier' => isset($this->_rsm->isIdentifierColumn[$dqlAlias][$key]), 'isMetaColumn' => \true, 'fieldName' => $fieldName, 'type' => $type, 'dqlAlias' => $dqlAlias, 'enumType' => $this->_rsm->enumMappings[$key] ?? null]; } // this column is a left over, maybe from a LIMIT query hack for example in Oracle or DB2 // maybe from an additional column that has not been defined in a NativeQuery ResultSetMapping. return null; } private function getDiscriminatorValues(ClassMetadata $classMetadata) : array { $values = array_map(function (string $subClass) : string { return (string) $this->getClassMetadata($subClass)->discriminatorValue; }, $classMetadata->subClasses); $values[] = (string) $classMetadata->discriminatorValue; return $values; } protected function getClassMetadata($className) { if (!isset($this->_metadataCache[$className])) { $this->_metadataCache[$className] = $this->_em->getClassMetadata($className); } return $this->_metadataCache[$className]; } protected function registerManaged(ClassMetadata $class, $entity, array $data) { if ($class->isIdentifierComposite) { $id = []; foreach ($class->identifier as $fieldName) { $id[$fieldName] = isset($class->associationMappings[$fieldName]) ? $data[$class->associationMappings[$fieldName]['joinColumns'][0]['name']] : $data[$fieldName]; } } else { $fieldName = $class->identifier[0]; $id = [$fieldName => isset($class->associationMappings[$fieldName]) ? $data[$class->associationMappings[$fieldName]['joinColumns'][0]['name']] : $data[$fieldName]]; } $this->_em->getUnitOfWork()->registerManaged($entity, $id, $data); } protected final function buildEnum($value, string $enumType) { if (is_array($value)) { return array_map(static function ($value) use($enumType) : BackedEnum { return $enumType::from($value); }, $value); } return $enumType::from($value); } }
Fatal error: Uncaught Error: Class "MailPoetVendor\Doctrine\ORM\Internal\Hydration\AbstractHydrator" not found in /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php:19 Stack trace: #0 /htdocs/wp-content/plugins/all-in-one-seo-pack/vendor/composer/ClassLoader.php(576): include() #1 /htdocs/wp-content/plugins/all-in-one-seo-pack/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('/htdocs/wp-cont...') #2 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(422): Composer\Autoload\ClassLoader->loadClass('MailPoetVendor\\...') #3 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(481): MailPoetVendor\Doctrine\ORM\EntityManager->newHydrator(5) #4 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(79): MailPoetVendor\Doctrine\ORM\Persisters\Entity\BasicEntityPersister->loadAll(Array, NULL, NULL, NULL) #5 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(74): MailPoetVendor\Doctrine\ORM\EntityRepository->findBy(Array) #6 /htdocs/wp-content/plugins/mailpoet/lib/Doctrine/Repository.php(84): MailPoetVendor\Doctrine\ORM\EntityRepository->findAll() #7 /htdocs/wp-content/plugins/mailpoet/lib/Settings/SettingsController.php(147): MailPoet\Doctrine\Repository->findAll() #8 /htdocs/wp-content/plugins/mailpoet/lib/Settings/SettingsController.php(37): MailPoet\Settings\SettingsController->ensureLoaded() #9 /htdocs/wp-content/plugins/mailpoet/lib/Config/Hooks.php(140): MailPoet\Settings\SettingsController->get('subscribe', Array) #10 /htdocs/wp-content/plugins/mailpoet/lib/Config/Hooks.php(121): MailPoet\Config\Hooks->setupSubscriptionEvents() #11 /htdocs/wp-content/plugins/mailpoet/lib/Config/Initializer.php(342): MailPoet\Config\Hooks->init() #12 /htdocs/wp-includes/class-wp-hook.php(324): MailPoet\Config\Initializer->pluginsLoaded('') #13 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #14 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #15 /htdocs/wp-settings.php(559): do_action('plugins_loaded') #16 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...') #17 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #18 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #19 /htdocs/index.php(17): require('/htdocs/wp-blog...') #20 {main} thrown in /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php on line 19