/**
  * @param DocumentManagerInterface  $dm    The DocumentManager the collection will be associated with.
  * @param object           $document       The parent document instance
  * @param array|Collection $collection     The collection to initialize with
  * @param string|null      $type           Type can be 'weak', 'hard' or null to get both weak and hard references.
  * @param string|null      $name           If set, name of the referencing property.
  * @param string|null      $refClass       Class the referrer document must be instanceof.
  * @param bool             $forceOverwrite If to force the database to be forced to the state of the collection
  *
  * @return ReferrersCollection
  */
 public static function createFromCollection(DocumentManagerInterface $dm, $document, $collection, $type = null, $name = null, $refClass = null, $forceOverwrite = false)
 {
     $referrerCollection = new self($dm, $document, $type, $name, null, $refClass);
     $referrerCollection->initializeFromCollection($collection, $forceOverwrite);
     return $referrerCollection;
 }
 /**
  * @param DocumentManagerInterface  $dm     The DocumentManager the collection will be associated with.
  * @param object           $document        The document with the references property
  * @param string           $property        The node property name with the multivalued references
  * @param array|Collection $collection      The collection to initialize with
  * @param string           $targetDocument  The class name of the target documents
  * @param bool             $forceOverwrite If to force the database to be forced to the state of the collection
  *
  * @return ReferenceManyCollection
  */
 public static function createFromCollection(DocumentManagerInterface $dm, $document, $property, $collection, $targetDocument, $forceOverwrite = false)
 {
     $referenceCollection = new self($dm, $document, $property, array(), $targetDocument);
     $referenceCollection->initializeFromCollection($collection, $forceOverwrite);
     return $referenceCollection;
 }
 /**
  * @param DocumentManagerInterface  $dm    The DocumentManager the collection will be associated with.
  * @param object           $document       The parent document instance
  * @param array|Collection $collection     The collection to initialize with
  * @param string|array     $filter         Filter string or array of filter string
  * @param int              $fetchDepth     Optional fetch depth, -1 to not override.
  * @param bool             $forceOverwrite If to force overwrite the state in the database to the state of the collection
  *
  * @return ChildrenCollection
  */
 public static function createFromCollection(DocumentManagerInterface $dm, $document, $collection, $filter = null, $fetchDepth = -1, $forceOverwrite = false)
 {
     $childrenCollection = new self($dm, $document, $filter, $fetchDepth);
     $childrenCollection->initializeFromCollection($collection, $forceOverwrite);
     return $childrenCollection;
 }