Feature #2621

Support SPLObjectStorage as container for references to other persisted objects

Added by Robert Lemke over 12 years ago. Updated almost 11 years ago.

Status:
Resolved
Priority:
Must have
Category:
Persistence
Start date:
2009-02-12
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

Currently references to other objects must be stored in an array or as a single property:

class Invoice {

   /**
    * @var array
    */
   protected $invoiceDetails = array();

   /**
    * @var Customer
    */
   protected $customer;
}

But in many cases it makes sense to store objects in an SPLObjectStorage:

class Blog {

   /**
    * @var \SPLObjectStorage
    */
   protected $posts;
}

By using the SPLObjectStorage we can assure that no post can be added twice
to a blog.

The Persistence Manager should therefore support SPLObjectStorages

Also available in: Atom PDF