2014-08-30 18:11:32 +02:00
|
|
|
<?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();
|
|
|
|
}
|
2014-08-30 18:11:32 +02:00
|
|
|
}
|