MOON
Server: Apache
System: Linux res.emeff.ca 3.10.0-962.3.2.lve1.5.24.10.el7.x86_64 #1 SMP Wed Mar 20 07:36:02 EDT 2019 x86_64
User: accemeff (1004)
PHP: 7.0.33
Disabled: NONE
Upload Files
File: /home/accemeff/vendor/craftcms/cms/src/db/FixedOrderExpression.php
<?php
/**
 * @link https://craftcms.com/
 * @copyright Copyright (c) Pixel & Tonic, Inc.
 * @license https://craftcms.github.io/license/
 */

namespace craft\db;

use yii\db\Expression;

/**
 * FixedOrderExpression represents the SQL used to apply a fixed order to a DB result.
 *
 * @author Pixel & Tonic, Inc. <support@pixelandtonic.com>
 * @since 3.0
 */
class FixedOrderExpression extends Expression
{
    // Properties
    // =========================================================================

    /**
     * @var string $column The column name that contains the values
     */
    public $column;

    /**
     * @var array The column values, in the order in which the rows should be returned in
     */
    public $values;

    /**
     * @var Connection The DB connection
     */
    public $db;

    // Public Methods
    // =========================================================================

    /**
     * Constructor
     *
     * @param string $column The column name that contains the values.
     * @param array $values The column values, in the order in which the rows should be returned in.
     * @param Connection $db The DB connection
     * @param array $params Parameters
     * @param array $config Name-value pairs that will be used to initialize the object properties.
     */
    public function __construct(string $column, array $values, Connection $db, array $params = [], array $config = [])
    {
        $this->column = $column;
        $this->values = $values;
        $this->db = $db;

        $expression = $db->getQueryBuilder()->fixedOrder($column, $values);
        parent::__construct($expression, $params, $config);
    }
}