/** * @param Collection $collection * @param bool|false $prefix * * @return array */ protected function getConditionArray(Collection $collection, $prefix = false) { $condition = $collection->getCondition(); if (!is_array($condition)) { $condition = ['_id' => $this->createObjectId($condition)]; } if ($prefix) { $condition = static::prefixArrayKeys($condition, $collection->getName() . '.'); } return $condition; }
protected function fetchSingle(Collection $collection, $statement) { $name = $collection->getName(); $entityName = $name; $row = $this->driver->fetch($statement); if (!$row) { return false; } if ($this->typable($collection)) { $entityName = $row->{$this->getType($collection)}; } $entities = new SplObjectStorage(); $entities[$this->transformSingleRow($row, $entityName)] = $collection; return $entities; }
protected function fetchSingle(Collection $collection, PDOStatement $statement) { $name = $collection->getName(); $entityName = $name; $row = $statement->fetch(PDO::FETCH_OBJ); if (!$row) { return false; } if ($this->typable($collection)) { $entityName = $this->inferGet($row, $this->getType($collection)); } $entities = new SplObjectStorage(); $entities[$this->transformSingleRow($row, $entityName)] = $collection; return $entities; }