public function sort($field = 'id', array $options = []) {
		$this->offsetGet(null);

		if (is_string($field)) {
			$sorter = function ($a, $b) use ($field) {
				if (is_array($a)) {
					$a = (object) $a;
				}
				if (is_array($b)) {
					$b = (object) $b;
				}
				return strcmp($a->$field, $b->$field);
			};
		} elseif (is_callable($field)) {
			$sorter = $field;
		} else {
			return $this;
		}
		return parent::sort($sorter, $options);
	}
public function sort($field = 'id', array $options = []) {
		$this->offsetGet(null);

		if (is_string($field)) {
			$sorter = function ($a, $b) use ($field) {
				if (is_array($a)) {
					$a = (object) $a;
				}
				if (is_array($b)) {
					$b = (object) $b;
				}
				return strcmp($a->$field, $b->$field);
			};
		} elseif (is_callable($field)) {
			$sorter = $field;
		} else {
			return $this;
		}
		return parent::sort($sorter, $options);
	}
public function sort ( $ field = 'id' , array $ options = [ ] ) { $ this -> offsetGet ( null ) ; if ( is_string ( $ field ) ) { $ sorter = function ( $ a , $ b ) use ( $ field ) { if ( is_array ( $ a ) ) { $ a = ( object ) $ a ; } if ( is_array ( $ b ) ) { $ b = ( object ) $ b ; } return strcmp ( $ a -> $ field , $ b -> $ field ) ; } ; } elseif ( is_callable ( $ field ) ) { $ sorter = $ field ; } else { return $ this ; } return parent :: sort ( $ sorter , $ options ) ; }
Sorts the objects in the collection, useful in situations where
you are already using the underlying datastore to sort results.

Overriden to load any data that has not yet been loaded.

@see lithium\util\Collection::sort()
@param string|callable $field The field to sort the data on, can also be a callback
to a custom sort function.
@param array $options Reserved for future use.
@return lithium\data\Collection Returns itself.
Sorts the objects in the collection useful in situations where you are already using the underlying datastore to sort results .