Cache
9 months ago
Decorator
9 months ago
Event
9 months ago
Exception
9 months ago
Id
9 months ago
Internal
9 months ago
Mapping
9 months ago
Persisters
8 months ago
Proxy
9 months ago
Query
9 months ago
Repository
9 months ago
Tools
9 months ago
Utility
9 months ago
AbstractQuery.php
9 months ago
Cache.php
9 months ago
Configuration.php
9 months ago
EntityManager.php
9 months ago
EntityManagerInterface.php
9 months ago
EntityNotFoundException.php
9 months ago
EntityRepository.php
9 months ago
Events.php
9 months ago
LazyCriteriaCollection.php
9 months ago
NativeQuery.php
9 months ago
NoResultException.php
9 months ago
NonUniqueResultException.php
9 months ago
ORMException.php
9 months ago
ORMInvalidArgumentException.php
9 months ago
ORMSetup.php
9 months ago
OptimisticLockException.php
9 months ago
PersistentCollection.php
9 months ago
PessimisticLockException.php
9 months ago
Query.php
9 months ago
QueryBuilder.php
9 months ago
TransactionRequiredException.php
9 months ago
UnexpectedResultException.php
9 months ago
UnitOfWork.php
9 months ago
Version.php
9 months ago
index.php
9 months ago
NativeQuery.php
46 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\ORM; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | use function array_values; |
| 6 | use function is_int; |
| 7 | use function key; |
| 8 | use function ksort; |
| 9 | class NativeQuery extends AbstractQuery |
| 10 | { |
| 11 | private $sql; |
| 12 | public function setSQL($sql) : self |
| 13 | { |
| 14 | $this->sql = $sql; |
| 15 | return $this; |
| 16 | } |
| 17 | public function getSQL() : string |
| 18 | { |
| 19 | return $this->sql; |
| 20 | } |
| 21 | protected function _doExecute() |
| 22 | { |
| 23 | $parameters = []; |
| 24 | $types = []; |
| 25 | foreach ($this->getParameters() as $parameter) { |
| 26 | $name = $parameter->getName(); |
| 27 | if ($parameter->typeWasSpecified()) { |
| 28 | $parameters[$name] = $parameter->getValue(); |
| 29 | $types[$name] = $parameter->getType(); |
| 30 | continue; |
| 31 | } |
| 32 | $value = $this->processParameterValue($parameter->getValue()); |
| 33 | $type = $parameter->getValue() === $value ? $parameter->getType() : Query\ParameterTypeInferer::inferType($value); |
| 34 | $parameters[$name] = $value; |
| 35 | $types[$name] = $type; |
| 36 | } |
| 37 | if ($parameters && is_int(key($parameters))) { |
| 38 | ksort($parameters); |
| 39 | ksort($types); |
| 40 | $parameters = array_values($parameters); |
| 41 | $types = array_values($types); |
| 42 | } |
| 43 | return $this->_em->getConnection()->executeQuery($this->sql, $parameters, $types, $this->_queryCacheProfile); |
| 44 | } |
| 45 | } |
| 46 |