collection->findOne(['name' => $userName]); return $this->entityConverter->toEntity($arrayEntity); } public function hasAnyUsers() { return (bool) $this->collection->findOne(); } public function deleteByName($userName) { $this->collection->remove(['name' => $userName]); $tokens = $this->db->selectCollection('tokens'); $tokens->remove(['additionalData' => $userName]); } }