<?php

namespace Apexl\Io\User\Entities\Operators;

use Apexl\Io\Operators\EntityDatabaseOperator;

class RoleOperator extends EntityDatabaseOperator
{
    public function __construct($table, $primaryKey = 'id')
    {
        parent::__construct($table, $primaryKey);
    }

    public function loadByName($name): array
    {
        $entity = $this->vault->select($this->dbTable)->fields()->where('name', $name)->execute()->fetchAssoc();

        return ['updateEntityData' => true, 'data' => $entity];
    }
}
