You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					63 lines
				
				1.5 KiB
			
		
		
			
		
	
	
					63 lines
				
				1.5 KiB
			| 
								 
											12 years ago
										 
									 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @link http://www.yiiframework.com/
							 | 
						||
| 
								 | 
							
								 * @copyright Copyright © 2008-2011 Yii Software LLC
							 | 
						||
| 
								 | 
							
								 * @license http://www.yiiframework.com/license/
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace yii\sphinx;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use yii\base\Object;
							 | 
						||
| 
								 | 
							
								use yii\base\InvalidParamException;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * 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
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
									/**
							 | 
						||
| 
								 | 
							
									 * @var string name of this index.
							 | 
						||
| 
								 | 
							
									 */
							 | 
						||
| 
								 | 
							
									public $name;
							 | 
						||
| 
								 | 
							
									/**
							 | 
						||
| 
								 
											12 years ago
										 
									 | 
							
									 * @var string type of the index.
							 | 
						||
| 
								 | 
							
									 */
							 | 
						||
| 
								 | 
							
									public $type;
							 | 
						||
| 
								 | 
							
									/**
							 | 
						||
| 
								 | 
							
									 * @var boolean whether this index is a runtime index.
							 | 
						||
| 
								 | 
							
									 */
							 | 
						||
| 
								 | 
							
									public $isRuntime;
							 | 
						||
| 
								 | 
							
									/**
							 | 
						||
| 
								 
											12 years ago
										 
									 | 
							
									 * @var string primary key of this index.
							 | 
						||
| 
								 
											12 years ago
										 
									 | 
							
									 */
							 | 
						||
| 
								 
											12 years ago
										 
									 | 
							
									public $primaryKey;
							 | 
						||
| 
								 
											12 years ago
										 
									 | 
							
									/**
							 | 
						||
| 
								 | 
							
									 * @var ColumnSchema[] column metadata of this index. Each array element is a [[ColumnSchema]] object, indexed by column names.
							 | 
						||
| 
								 | 
							
									 */
							 | 
						||
| 
								 | 
							
									public $columns = [];
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									/**
							 | 
						||
| 
								 | 
							
									 * 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;
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									/**
							 | 
						||
| 
								 | 
							
									 * Returns the names of all columns in this table.
							 | 
						||
| 
								 | 
							
									 * @return array list of column names
							 | 
						||
| 
								 | 
							
									 */
							 | 
						||
| 
								 | 
							
									public function getColumnNames()
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										return array_keys($this->columns);
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								}
							 |