HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/magento.bikenow.co/vendor/magento/framework/DB/SubSelect.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Framework\DB;

use Magento\Framework\App\ResourceConnection;
use Magento\Framework\DB\Adapter\AdapterInterface;

/**
 * Class Concat
 */
class SubSelect extends \Zend_Db_Expr
{
    /**
     * @var string
     */
    protected $table;

    /**
     * @var string[]
     */
    protected $columns;

    /**
     * @var string
     */
    protected $originColumn;

    /**
     * @var string
     */
    protected $targetColumn;

    /**
     * @var \Magento\Framework\App\ResourceConnection
     */
    protected $resource;

    /**
     * @var string
     */
    protected $connectionName;

    /**
     * @var AdapterInterface
     */
    protected $connection;

    /**
     * @param ResourceConnection $resource
     * @param string $connectionName
     * @param string $table
     * @param string[] $columns
     * @param string $originColumn
     * @param string $targetColumn
     */
    public function __construct(
        ResourceConnection $resource,
        $table,
        array $columns,
        $originColumn,
        $targetColumn,
        $connectionName = ResourceConnection::DEFAULT_CONNECTION
    ) {
        $this->resource = $resource;
        $this->connectionName = $connectionName;
        $this->table = $table;
        $this->columns = $columns;
        $this->originColumn = $originColumn;
        $this->targetColumn = $targetColumn;
    }

    /**
     * @return string
     */
    public function __toString()
    {
        $select = $this->getConnection()->select()->from(
            $this->resource->getTableName($this->table),
            array_values($this->columns)
        )->where(
            sprintf(
                '%s = %s',
                $this->getConnection()->quoteIdentifier($this->originColumn),
                $this->getConnection()->quoteIdentifier($this->targetColumn)
            )
        )->limit(1);
        return sprintf('(%s)', $select);
    }

    /**
     * Returns connection
     *
     * @return AdapterInterface
     */
    protected function getConnection()
    {
        if (!$this->connection) {
            $this->connection = $this->resource->getConnection($this->connectionName);
        }
        return $this->connection;
    }
}