szurubooru/src/Dao/UserDao.php

23 lines
517 B
PHP
Raw Normal View History

<?php
namespace Szurubooru\Dao;
class UserDao extends AbstractDao implements ICrudDao
{
public function __construct(
\Szurubooru\DatabaseConnection $databaseConnection)
{
parent::__construct($databaseConnection, 'users', '\Szurubooru\Entities\User');
}
public function getByName($userName)
{
$arrayEntity = $this->collection->findOne(['name' => $userName]);
return $this->entityConverter->toEntity($arrayEntity);
}
2014-09-01 19:43:49 +02:00
public function hasAnyUsers()
{
return (bool) $this->collection->findOne();
}
}