8000 Question: is there any way to reindex a collection using callable function that defines index? · Issue #374 · doctrine/collections · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Question: is there any way to reindex a collection using callable function that defines index? #374
Open
@OleksiiBulba

Description

@OleksiiBulba
Issue body actions

Hello! I'm looking for a way to reindex a collection using my own callable function. It might be something like that:

interface ReadableCollection extends Countable, IteratorAggregate
{
    /* ... other methods */

    public function reindex(?Closure $p = null): ReadableCollection;

    /* ... other methods */
}

class ArrayCollection implements Collection, Selectable, Stringable
{
    /* ... other methods */

    public function reindex(?Closure $p = null): ReadableCollection
    {
        return $this->createFrom(array_combine(array_map($p, $array), $array));
    }

    /* ... other methods */
}

Is it possible somehow or might be implemented? Thanks for any help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0