public function createCollection(array &$data = null, $primaryId = null) {
		$collectionClass = $this->getCollectionClass();
		$modelClass      = $this->getModelClass();
		
		if ($primaryId === null) {
			$primaryId = $this->getPrimaryName();
		}

		// Primary ID data handling
		if (! empty($data) || $primaryId !== null) {
			$validation = true;

			array_walk($data, function(&$item) use($primaryId, &$validation) {
				if (! isset($item[$primaryId])) {
					$validation = false;
				}
			});

			if ($validation) {
				array_walk($data, function(&$item) use($primaryId) {
					if (is_object($item[$primaryId])) {
						$item[$primaryId] = (string) $item[$primaryId];
					}
				});
			} else {
				$primaryId = null;
			}
		}

		// Creating and supplying of the dependencies
		$collection = $collectionClass::factory($data, $modelClass, $primaryId);
		$collection->setDatagate($this);

		if ($this->hasLocator()) {
			$collection->setLocator($this->getLocator());
		}

		return $collection;
	}
public function createCollection(array &$data = null, $primaryId = null) {
		$collectionClass = $this->getCollectionClass();
		$modelClass      = $this->getModelClass();
		
		if ($primaryId === null) {
			$primaryId = $this->getPrimaryName();
		}

		// Primary ID data handling
		if (! empty($data) || $primaryId !== null) {
			$validation = true;

			array_walk($data, function(&$item) use($primaryId, &$validation) {
				if (! isset($item[$primaryId])) {
					$validation = false;
				}
			});

			if ($validation) {
				array_walk($data, function(&$item) use($primaryId) {
					if (is_object($item[$primaryId])) {
						$item[$primaryId] = (string) $item[$primaryId];
					}
				});
			} else {
				$primaryId = null;
			}
		}

		// Creating and supplying of the dependencies
		$collection = $collectionClass::factory($data, $modelClass, $primaryId);
		$collection->setDatagate($this);

		if ($this->hasLocator()) {
			$collection->setLocator($this->getLocator());
		}

		return $collection;
	}
public function createCollection ( array & $ data = null , $ primaryId = null ) { $ collectionClass = $ this -> getCollectionClass ( ) ; $ modelClass = $ this -> getModelClass ( ) ; if ( $ primaryId === null ) { $ primaryId = $ this -> getPrimaryName ( ) ; } // Primary ID data handling if ( ! empty ( $ data ) || $ primaryId !== null ) { $ validation = true ; array_walk ( $ data , function ( & $ item ) use ( $ primaryId , & $ validation ) { if ( ! isset ( $ item [ $ primaryId ] ) ) { $ validation = false ; } } ) ; if ( $ validation ) { array_walk ( $ data , function ( & $ item ) use ( $ primaryId ) { if ( is_object ( $ item [ $ primaryId ] ) ) { $ item [ $ primaryId ] = ( string ) $ item [ $ primaryId ] ; } } ) ; } else { $ primaryId = null ; } } // Creating and supplying of the dependencies $ collection = $ collectionClass :: factory ( $ data , $ modelClass , $ primaryId ) ; $ collection -> setDatagate ( $ this ) ; if ( $ this -> hasLocator ( ) ) { $ collection -> setLocator ( $ this -> getLocator ( ) ) ; } return $ collection ; }
Create a new collection, empty or with the supplied data

@param  array  $data      Initial data for the collection
@param  string $primaryId Specify the primary ID
@return \ZExt\Model\Collection
Create a new collection empty or with the supplied data