UserHandler.php 806 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

namespace LQDN\Handler;

use Doctrine\DBAL\Connection;
use LQDN\Command\UserUpdateByAdminCommand;

class UserHandler
{
    private $connection;

    public function __construct(Connection $connection)
    {
        $this->connection = $connection;
    }

    /**
     * Update of a user from the admin.
     *
     * @param UserUpdateByAdminCommand $command
     */
    public function handleUserUpdateByAdminCommand(UserUpdateByAdminCommand $command)
    {
        $this->connection->executeUpdate('UPDATE users SET pseudo = :username, email = :email, commentaire = :comment WHERE id = :id', [
            'username' => $command->getUsername(),
            'email' => $command->getEmail(),
            'comment' => $command->getComment(),
            'id' => $command->getId(),
        ]);
    }
}