szurubooru/src/Dao/UserDao.php
2014-10-18 18:48:17 +02:00

22 lines
517 B
PHP

<?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);
}
public function hasAnyUsers()
{
return (bool) $this->collection->findOne();
}
}