php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57205 Request for additional SplObjectStorage methods.
Submitted: 2006-08-30 11:53 UTC Modified: 2014-03-28 19:48 UTC
From: wb at pro-net dot co dot uk Assigned: helly (profile)
Status: Closed Package: SPL related
PHP Version: 5.* OS: *
Private report: No CVE-ID: None
 [2006-08-30 11:53 UTC] wb at pro-net dot co dot uk
Description:
------------
I would just like to propose the addition of the following methods to the SplObjectStorage class. These methods allow you to specify the object attachment position and will therefore affect the order the objects are returned when iterating over the SplObjectStorage object.


/**
 * Attach an object before an existing object.
 *
 * If $new is already attached then it position is moved.
 * If $ref is not attached an exception is thrown.
 */
public function attachBefore($new, $ref);

/**
 * Attach an object after an existing object.
 *
 * Works as attachBefore().
 */
public function attachAfter($new, $ref);


/**
 * Attach an object to the front.
 */
public function attachFirst($obj);



Reproduce code:
---------------
N/A

Expected result:
----------------
N/A

Actual result:
--------------
N/A

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-31 21:34 UTC] helly@php.net
Right now this is impossible as we store them by hash codes. I need to think about it.
 [2006-09-01 05:38 UTC] wb at pro-net dot co dot uk
Thanks for taking the time to consider the request.

I eagerly await your decision :)
 [2014-03-27 15:21 UTC] levim@php.net
-Package: SPL +Package: SPL related
 [2014-03-28 19:48 UTC] levim@php.net
-Status: Assigned +Status: Closed
 [2014-03-28 19:48 UTC] levim@php.net
Closing. This is infeasible to do given the current implementation and a new implementation would likely cause backwards compatibility breaks.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Feb 24 05:01:26 2020 UTC