IndexSchema.php 1.54 KB
Newer Older
1 2 3
<?php
/**
 * @link http://www.yiiframework.com/
Carsten Brandt committed
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 * @license http://www.yiiframework.com/license/
 */

namespace yii\sphinx;

use yii\base\Object;

/**
 * IndexSchema represents the metadata of a Sphinx index.
 *
 * @property array $columnNames List of column names. This property is read-only.
 *
 * @author Paul Klimov <klimov.paul@gmail.com>
 * @since 2.0
 */
class IndexSchema extends Object
{
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
    /**
     * @var string name of this index.
     */
    public $name;
    /**
     * @var string type of the index.
     */
    public $type;
    /**
     * @var boolean whether this index is a runtime index.
     */
    public $isRuntime;
    /**
     * @var string primary key of this index.
     */
    public $primaryKey;
    /**
     * @var ColumnSchema[] column metadata of this index. Each array element is a [[ColumnSchema]] object, indexed by column names.
     */
    public $columns = [];
42

43 44 45 46 47 48 49 50 51 52
    /**
     * Gets the named column metadata.
     * This is a convenient method for retrieving a named column even if it does not exist.
     * @param  string       $name column name
     * @return ColumnSchema metadata of the named column. Null if the named column does not exist.
     */
    public function getColumn($name)
    {
        return isset($this->columns[$name]) ? $this->columns[$name] : null;
    }
53

54 55 56 57 58 59 60 61
    /**
     * Returns the names of all columns in this table.
     * @return array list of column names
     */
    public function getColumnNames()
    {
        return array_keys($this->columns);
    }
AlexGx committed
62
}