Full implemantation
This commit is contained in:
@ -8,10 +8,22 @@ use ProVM\Common\Implement\Repository;
|
||||
|
||||
class Message extends Repository
|
||||
{
|
||||
public function __construct(PDO $connection, LoggerInterface $logger)
|
||||
public function __construct(PDO $connection, LoggerInterface $logger, \ProVM\Common\Factory\Model $factory)
|
||||
{
|
||||
parent::__construct($connection, $logger);
|
||||
$this->setTable('messages_states');
|
||||
$this->setTable('messages_states')
|
||||
->setFactory($factory);
|
||||
}
|
||||
|
||||
protected \ProVM\Common\Factory\Model $factory;
|
||||
public function getFactory(): \ProVM\Common\Factory\Model
|
||||
{
|
||||
return $this->factory;
|
||||
}
|
||||
public function setFactory(\ProVM\Common\Factory\Model $factory): Message
|
||||
{
|
||||
$this->factory = $factory;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function fieldsForUpdate(): array
|
||||
@ -64,6 +76,7 @@ class Message extends Repository
|
||||
return (new \ProVM\Emails\Model\State\Message())
|
||||
->setId($row['id'])
|
||||
->setName($row['name'])
|
||||
->setMessage($this->getFactory()->find(\ProVM\Emails\Model\Message::class)->fetchById($row['message_id']))
|
||||
->setValue(($row['value'] ?? 0) !== 0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user