1<?php 2 3/* 4 * This file is part of the TYPO3 CMS project. 5 * 6 * It is free software; you can redistribute it and/or modify it under 7 * the terms of the GNU General Public License, either version 2 8 * of the License, or any later version. 9 * 10 * For the full copyright and license information, please read the 11 * LICENSE.txt file that was distributed with this source code. 12 * 13 * The TYPO3 project - inspiring people to share! 14 */ 15 16namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom; 17 18use TYPO3\CMS\Extbase\Persistence\QueryInterface; 19 20/** 21 * Determines the relative order of two rows in the result set by evaluating operand for 22 * each. 23 * @internal only to be used within Extbase, not part of TYPO3 Core API. 24 */ 25class Ordering implements OrderingInterface 26{ 27 /** 28 * @var DynamicOperandInterface 29 */ 30 protected $operand; 31 32 /** 33 * @var string One of \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_* 34 */ 35 protected $order; 36 37 /** 38 * Constructs the Ordering instance 39 * 40 * @param DynamicOperandInterface $operand The operand; non-null 41 * @param string $order One of \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_* 42 */ 43 public function __construct(DynamicOperandInterface $operand, $order = QueryInterface::ORDER_ASCENDING) 44 { 45 $this->operand = $operand; 46 $this->order = $order; 47 } 48 49 /** 50 * The operand by which to order. 51 * 52 * @return DynamicOperandInterface the operand; non-null 53 */ 54 public function getOperand() 55 { 56 return $this->operand; 57 } 58 59 /** 60 * Gets the order. 61 * 62 * @return string One of \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_* 63 */ 64 public function getOrder() 65 { 66 return $this->order; 67 } 68} 69