src/ORM/ArrayList.php
public function removeDuplicates($field = 'ID')
    {
        $seen = [];
        $renumberKeys = false;

        foreach ($this->items as $key => $item) {
            $value = $this->extractValue($item, $field);

            if (array_key_exists($value, $seen)) {
                $renumberKeys = true;
                unset($this->items[$key]);
            }

            $seen[$value] = true;
        }

        if ($renumberKeys) {
            $this->items = array_values($this->items);
        }

        return $this;
    }
public function removeDuplicates($field = 'ID')
    {
        $seen = [];
        $renumberKeys = false;

        foreach ($this->items as $key => $item) {
            $value = $this->extractValue($item, $field);

            if (array_key_exists($value, $seen)) {
                $renumberKeys = true;
                unset($this->items[$key]);
            }

            $seen[$value] = true;
        }

        if ($renumberKeys) {
            $this->items = array_values($this->items);
        }

        return $this;
    }
public function removeDuplicates ( $ field = 'ID' ) { $ seen = [ ] ; $ renumberKeys = false ; foreach ( $ this -> items as $ key => $ item ) { $ value = $ this -> extractValue ( $ item , $ field ) ; if ( array_key_exists ( $ value , $ seen ) ) { $ renumberKeys = true ; unset ( $ this -> items [ $ key ] ) ; } $ seen [ $ value ] = true ; } if ( $ renumberKeys ) { $ this -> items = array_values ( $ this -> items ) ; } return $ this ; }
Removes items from this list which have a duplicate value for a certain
field. This is especially useful when combining lists.

@param string $field
@return $this
Removes items from this list which have a duplicate value for a certain field . This is especially useful when combining lists .