public function getCollection($property, $model = null, $primary = null) {
		$list = $this->getList($property);
		
		// Integrity checking
		foreach ($list as $key => $item) {
			if ($item === null) {
				unset($list[$key]);
				continue;
			}
			
			if (! is_object($item)) {
				throw new Exception('Unable to create a collection of non objects');
			}
			
			if (! $item instanceof ModelInterface) {
				throw new Exception('Object must implements "ModelInterface" to be in collection');
			}
		}
		
		// Model's class name resolve
		if ($model === null && isset($item) && $item->hasCollection()) {
			$model = $item->getCollection()->getModel();
		}
		
		if ($model === null && isset($item)) {
			$currentClass   = get_class($item);
			$extensionStack = array($currentClass);
			
			while ($currentClass = get_parent_class($currentClass)) {
				$extensionStack[] = $currentClass;
			}
			
			$primaryIndex = array_search(self::PRIMARY_MODEL, $extensionStack);
			
			if ($primaryIndex === 0 || $primaryIndex === false) {
				$model = self::PRIMARY_MODEL;
			} else {
				$model = $extensionStack[$primaryIndex - 1];
			}
		}
		
		// Primary resolve
		if ($primary === false) {
			$primary = null;
		} else if ($primary === null && isset($item) && $item->hasCollection()) {
			$primary = $item->getCollection()->getPrimary();
		}
		
		$collection = new self($list, $model, $primary);
		
		if ($this->hasLocator()) {
			$collection->setLocator($this->getLocator());
		}
		
		return $collection;
	}
public function getCollection($property, $model = null, $primary = null) {
		$list = $this->getList($property);
		
		// Integrity checking
		foreach ($list as $key => $item) {
			if ($item === null) {
				unset($list[$key]);
				continue;
			}
			
			if (! is_object($item)) {
				throw new Exception('Unable to create a collection of non objects');
			}
			
			if (! $item instanceof ModelInterface) {
				throw new Exception('Object must implements "ModelInterface" to be in collection');
			}
		}
		
		// Model's class name resolve
		if ($model === null && isset($item) && $item->hasCollection()) {
			$model = $item->getCollection()->getModel();
		}
		
		if ($model === null && isset($item)) {
			$currentClass   = get_class($item);
			$extensionStack = array($currentClass);
			
			while ($currentClass = get_parent_class($currentClass)) {
				$extensionStack[] = $currentClass;
			}
			
			$primaryIndex = array_search(self::PRIMARY_MODEL, $extensionStack);
			
			if ($primaryIndex === 0 || $primaryIndex === false) {
				$model = self::PRIMARY_MODEL;
			} else {
				$model = $extensionStack[$primaryIndex - 1];
			}
		}
		
		// Primary resolve
		if ($primary === false) {
			$primary = null;
		} else if ($primary === null && isset($item) && $item->hasCollection()) {
			$primary = $item->getCollection()->getPrimary();
		}
		
		$collection = new self($list, $model, $primary);
		
		if ($this->hasLocator()) {
			$collection->setLocator($this->getLocator());
		}
		
		return $collection;
	}
public function getCollection ( $ property , $ model = null , $ primary = null ) { $ list = $ this -> getList ( $ property ) ; // Integrity checking foreach ( $ list as $ key => $ item ) { if ( $ item === null ) { unset ( $ list [ $ key ] ) ; continue ; } if ( ! is_object ( $ item ) ) { throw new Exception ( 'Unable to create a collection of non objects' ) ; } if ( ! $ item instanceof ModelInterface ) { throw new Exception ( 'Object must implements "ModelInterface" to be in collection' ) ; } } // Model's class name resolve if ( $ model === null && isset ( $ item ) && $ item -> hasCollection ( ) ) { $ model = $ item -> getCollection ( ) -> getModel ( ) ; } if ( $ model === null && isset ( $ item ) ) { $ currentClass = get_class ( $ item ) ; $ extensionStack = array ( $ currentClass ) ; while ( $ currentClass = get_parent_class ( $ currentClass ) ) { $ extensionStack [ ] = $ currentClass ; } $ primaryIndex = array_search ( self :: PRIMARY_MODEL , $ extensionStack ) ; if ( $ primaryIndex === 0 || $ primaryIndex === false ) { $ model = self :: PRIMARY_MODEL ; } else { $ model = $ extensionStack [ $ primaryIndex - 1 ] ; } } // Primary resolve if ( $ primary === false ) { $ primary = null ; } else if ( $ primary === null && isset ( $ item ) && $ item -> hasCollection ( ) ) { $ primary = $ item -> getCollection ( ) -> getPrimary ( ) ; } $ collection = new self ( $ list , $ model , $ primary ) ; if ( $ this -> hasLocator ( ) ) { $ collection -> setLocator ( $ this -> getLocator ( ) ) ; } return $ collection ; }
Get a collection of properties-models

@param  string $property
@param  string $primary
@return Collection
@throws Exception
Get a collection of properties - models