123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
-
-
- namespace Doctrine\ORM\Query\Expr;
-
-
- class OrderBy
- {
- protected $_preSeparator = '';
- protected $_separator = ', ';
- protected $_postSeparator = '';
- protected $_allowedClasses = array();
-
- private $_parts = array();
-
- public function __construct($sort = null, $order = null)
- {
- if ($sort) {
- $this->add($sort, $order);
- }
- }
-
- public function add($sort, $order = null)
- {
- $order = ! $order ? 'ASC' : $order;
- $this->_parts[] = $sort . ' '. $order;
- }
-
- public function count()
- {
- return count($this->_parts);
- }
-
- public function __tostring()
- {
- return $this->_preSeparator . implode($this->_separator, $this->_parts) . $this->_postSeparator;
- }
- }
|