Skip to content

Commit

Permalink
Merge branch '5.2' into 5
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jun 4, 2024
2 parents e35f12c + 9546450 commit a6ab217
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/ORM/ArrayList.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ public function getIterator(): Traversable

/**
* Return an array of the actual items that this ArrayList contains.
*
* @return array<T>
*/
public function toArray()
{
Expand Down Expand Up @@ -477,6 +479,8 @@ protected function parseSortColumn($column, $direction = null)
* @example $list->sort('Name DESC'); // DESC sorting
* @example $list->sort('Name', 'ASC');
* @example $list->sort(array('Name'=>'ASC,'Age'=>'DESC'));
*
* @return static<T>
*/
public function sort()
{
Expand Down Expand Up @@ -589,6 +593,7 @@ public function canFilterBy($by)
*
* @param string $key
* @param mixed $value
* @return T|null
*/
public function find($key, $value)
{
Expand All @@ -609,6 +614,8 @@ public function find($key, $value)
* Also supports SearchFilter syntax
* @example // include anyone with "sam" anywhere in their name
* $list = $list->filter('Name:PartialMatch', 'sam');
*
* @return static<T>
*/
public function filter()
{
Expand All @@ -635,6 +642,7 @@ public function filter()
* $list = $list->filterAny('Name:PartialMatch', 'sam');
*
* @param string|array See {@link filter()}
* @return static<T>
*/
public function filterAny()
{
Expand All @@ -656,6 +664,8 @@ public function filterAny()
* Also supports SearchFilter syntax
* @example // everyone except anyone with "sam" anywhere in their name
* $list = $list->exclude('Name:PartialMatch', 'sam');
*
* @return static<T>
*/
public function exclude()
{
Expand Down Expand Up @@ -829,6 +839,8 @@ protected function normaliseFilterArgs($column, $value = null)
* Filter this list to only contain the given Primary IDs
*
* @param array $ids Array of integers, will be automatically cast/escaped.
*
* @return static<T>
*/
public function byIDs($ids)
{
Expand Down
11 changes: 11 additions & 0 deletions src/ORM/DataList.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ public function canFilterBy($fieldName)
/**
* Return a new DataList instance with the records returned in this query
* restricted by a limit clause.
* @return static<T>
*/
public function limit(?int $length, int $offset = 0): static
{
Expand Down Expand Up @@ -364,6 +365,8 @@ public function distinct($value)
* @example $list = $list->sort(['Name' => 'ASC', 'Age' => 'DESC']);
* @example $list = $list->sort('MyRelation.MyColumn ASC')
* @example $list->sort(null); // wipe any existing sort
*
* @return static<T>
*/
public function sort(...$args): static
{
Expand Down Expand Up @@ -480,6 +483,7 @@ public function orderBy(string $orderBy): static
* ->filter('Field:not', null) will generate '"Field" IS NOT NULL'
*
* @param string|array Escaped SQL statement. If passed as array, all keys and values will be escaped internally
* @return static<T>
*/
public function filter()
{
Expand Down Expand Up @@ -541,6 +545,7 @@ public function addFilter($filterArray)
* // SQL: WHERE (("Name" IN ('bob', 'phil')) OR ("Age" IN ('21', '43'))
*
* @param string|array See {@link filter()}
* @return static<T>
*/
public function filterAny()
{
Expand Down Expand Up @@ -681,6 +686,7 @@ protected function isValidRelationName($field)
*
* @param string|array
* @param string [optional]
* @return static<T>
*/
public function exclude()
{
Expand Down Expand Up @@ -824,6 +830,7 @@ public function rightJoin($table, $onClause, $alias = null, $order = 20, $parame
/**
* Return an array of the actual items that this DataList contains at this stage.
* This is when the query is actually executed.
* @return array<T>
*/
public function toArray()
{
Expand Down Expand Up @@ -1658,6 +1665,7 @@ public function sum($fieldName)
* Returns the first item in this DataList
*
* The object returned is not cached, unlike {@link DataObject::get_one()}
* @return T|null
*/
public function first()
{
Expand All @@ -1676,6 +1684,7 @@ public function first()
* Returns the last item in this DataList
*
* The object returned is not cached, unlike {@link DataObject::get_one()}
* @return T|null
*/
public function last()
{
Expand Down Expand Up @@ -1708,6 +1717,7 @@ public function exists()
*
* @param string $key
* @param string $value
* @return T|null
*/
public function find($key, $value)
{
Expand Down Expand Up @@ -1736,6 +1746,7 @@ public function byIDs($ids)
* Return the first DataObject with the given ID
*
* The object returned is not cached, unlike {@link DataObject::get_by_id()}
* @return T|null
*/
public function byID($id)
{
Expand Down

0 comments on commit a6ab217

Please sign in to comment.