object will be loaded with the items in the same order as they where created per LIST.

@param Connection $dbal
@param $shop_order_id

@return AmazonReferenceIdManager|null

@throws \InvalidArgumentException
17170
public static function createFromShopOrderId(Connection $dbal, $shop_order_id)
    {
        $data = $dbal->fetchAll(
            'select * from '.self::PERSIST_TABLE.' WHERE `shop_order_id` = ? ORDER BY `cmsident`',
            array($shop_order_id)
        );
        $manager = self::createFromRecordList($data);

        if (null === $manager) {
            throw new \InvalidArgumentException("unable to find an an id mapper object based on the shop_order_id [{$shop_order_id}]");
        }

        return $manager;
    }
1004122
public static function createAdapterFromDoctrine2(\Doctrine\DBAL\Connection $dbalConnection)
    {
        return new \Soluble\DbWrapper\Adapter\Doctrine\Dbal2Adapter($dbalConnection);
    }
855864
public function getConnection()
    {
        $repositoryConfig = $this->repositoryConfigurationProvider->getRepositoryConfig();
        // Taking provided connection name if any.
        // Otherwise, just fallback to the default connection.

        if (isset($repositoryConfig['search']['connection'])) {
            $doctrineConnectionId = sprintf('doctrine.dbal.%s_connection', $repositoryConfig['search']['connection']);
        } else {
            // "database_connection" is an alias to the default connection, set up by DoctrineBundle.
            $doctrineConnectionId = 'database_connection';
        }

        if (!$this->container->has($doctrineConnectionId)) {
            throw new InvalidArgumentException(
                "Invalid Doctrine connection '{$repositoryConfig['search']['connection']}' for repository '{$repositoryConfig['alias']}'." .
                'Valid connections are ' . implode(', ', array_keys($this->container->getParameter('doctrine.connections')))
            );
        }

        return $this->container->get($doctrineConnectionId);
    }
1039529
public static function hasOrderByOnFetchJoinedToManyAssociation(QueryBuilder $queryBuilder, ManagerRegistry $managerRegistry): bool
    {
        if (
            0 === \count($selectParts = $queryBuilder->getDQLPart('select')) ||
            0 === \count($queryBuilder->getDQLPart('join')) ||
            0 === \count($orderByParts = $queryBuilder->getDQLPart('orderBy'))
        ) {
            return false;
        }

        $rootAliases = $queryBuilder->getRootAliases();

        $selectAliases = [];

        foreach ($selectParts as $select) {
            foreach ($select->getParts() as $part) {
                [$alias] = explode('.', $part);

                $selectAliases[] = $alias;
            }
        }

        $selectAliases = array_diff($selectAliases, $rootAliases);
        if (0 === \count($selectAliases)) {
            return false;
        }

        $orderByAliases = [];

        foreach ($orderByParts as $orderBy) {
            foreach ($orderBy->getParts() as $part) {
                if (false !== strpos($part, '.')) {
                    [$alias] = explode('.', $part);

                    $orderByAliases[] = $alias;
                }
            }
        }

        $orderByAliases = array_diff($orderByAliases, $rootAliases);
        if (0 === \count($orderByAliases)) {
            return false;
        }

        foreach ($orderByAliases as $orderByAlias) {
            $inToManyContext = false;

            foreach (QueryBuilderHelper::traverseJoins($orderByAlias, $queryBuilder, $managerRegistry) as $alias => [$metadata, $association]) {
                if ($inToManyContext && \in_array($alias, $selectAliases, true)) {
                    return true;
                }

                if (null !== $association && $metadata->isCollectionValuedAssociation($association)) {
                    $inToManyContext = true;
                }
            }
        }

        return false;
    }
114750
public static function getReference() {
		if(self::$entity_manager == null)
			self::initialize();

		return call_user_func_array(array(self::$entity_manager, "getReference"), func_get_args());
	}
935814
public function retrieveCustomerByExternalReference($reference)
  {
    $ep = $this->_getEndpoint();
    $payload = new PaginatedDataNodePayload();
    $payload->filter = [
      AdvancedFilterPayload::create(
        'externalReference',
        AdvancedFilterComparator::EQUAL,
        $reference
      ),
    ];
    $customers = $this->_processRequest($ep->all($payload));
    if(count($customers->items) >= 1)
    {
      return Arrays::first($customers->items);
    }
    else
    {
      throw new NotFoundException(
        "No customer could be located with the reference $reference"
      );
    }
  }
950497
protected function getAmazonIdReferenceManager(\TdbShopOrder $order)
    {
        $manager = null;
        try {
            $manager = $this->config->amazonReferenceIdManagerFactory(
                $this->getDb(),
                AmazonPaymentGroupConfig::AMAZON_REFERENCE_ID_MANAGER_FACTORY_TYPE_SHOP_ORDER_ID,
                $order->id
            );
        } catch (\InvalidArgumentException $e) {
            $manager = new AmazonReferenceIdManager($order->getAmazonOrderReferenceId(), $order->id);
        }

        return $manager;
    }
852178
private function getOrderStoreReference()
    {
        return \UOL\PagSeguro\Helper\Data::getOrderStoreReference(
            $this->_scopeConfig->getValue('pagseguro/store/reference'),
            $this->_order->getEntityId()
        );
    }
910694
public static function getReferenceId($reference, string $storeAs)
    {
        return $storeAs === self::REFERENCE_STORE_AS_ID ? $reference : $reference[self::getReferencePrefix($storeAs) . 'id'];
    }
62637
private static function connect($connection_name) {
		if (array_key_exists($connection_name, self::$connections)) {
			return self::$connections[$connection_name];
		}

		if (!array_key_exists($connection_name, self::$parameters)) {
			throw new RuntimeException('Connection "' . $connection_name . '" has not been set');
		}

		$conn = DABLPDO::connect(self::$parameters[$connection_name]);
		return (self::$connections[$connection_name] = $conn);
	}
562277
public static function createFromRecordList(array $recordList)
    {
        $manager = null;
        foreach ($recordList as $row) {
            if (null === $manager) {
                $manager = new self($row['amazon_order_reference_id'], $row['shop_order_id']);
            }
            $item = self::createItemFromRow($row);
            $manager->idLists[$item->getType()]->addItem($item);
        }

        return $manager;
    }
464910
protected function setOrderAccountOrder($order_id)
    {
        $this->data_order = $this->order->get($order_id);

        if (empty($this->data_order)) {
            $this->outputHttpStatus(404);
        }

        $this->prepareOrderAccountOrder($this->data_order);
    }
1219336
@Override
	@Transactional(enabled = false)
	public CommerceOrder createCommerceOrder(long commerceOrderId) {
		return commerceOrderPersistence.create(commerceOrderId);
	}
149844
static function cleanupOrder( $orderID )
    {
        $db = eZDB::instance();
        $orderID =(int) $orderID;
        $rows = $db->arrayQuery( "SELECT productcollection_id, order_nr FROM ezorder WHERE id='$orderID'" );
        if ( count( $rows ) > 0 )
        {
            // Who deletes which order in shop should be logged.
            eZAudit::writeAudit( 'order-delete', array( 'Order ID' => $orderID,
                                                        'Comment' => 'Removed the order and its related data from the database: eZOrder::cleanupOrder()' ) );

            $productCollectionID = $rows[0]['productcollection_id'];
            $orderNr = (int)$rows[0]['order_nr'];
            $db = eZDB::instance();
            $db->begin();
            $db->query( "DELETE FROM ezorder where id='$orderID'" );
            $db->query( "DELETE FROM ezproductcollection where id='$productCollectionID'" );
            $db->query( "DELETE FROM ezproductcollection_item where productcollection_id='$productCollectionID'" );
            $db->query( "DELETE FROM ezorder_status_history WHERE order_id=$orderNr" );
            $db->commit();
        }
    }
188957
public function setCatalogId(int $nb_catalog_id) : CNabuDataObject
    {
        if ($nb_catalog_id === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$nb_catalog_id")
            );
        }
        $this->setValue('nb_catalog_id', $nb_catalog_id);
        
        return $this;
    }
1205129
public function orderBy() {
        $args = func_get_args();
        $this->build()->bindExpression('orderBy', $args[0] . " " . (empty($args[1]) ? ' ASC ' : " $args[1]"));

        return $this->connection;
    }
1317710
protected function _getStoreId()
    {
        $storeEnv = Mage::app()->getStore();
        if ($storeEnv->isAdmin()) {
            /** @var Mage_Adminhtml_Model_Session_Quote */
            $quoteSession = $this->_orderHelper->getAdminQuoteSessionModel();
            // when in the admin, the store id the order is actually being created
            // for should be used instead of the admin store id - should be
            // available in the session
            $storeEnv = $quoteSession->getStore();
        }
        return $storeEnv->getId();
    }