eZ\Publish\Core\Persistence\Legacy\User\Gateway\DoctrineDatabase::assignRole PHP Method

assignRole() public method

Assigns role to user with given limitation.
public assignRole ( mixed $contentId, mixed $roleId, array $limitation )
$contentId mixed
$roleId mixed
$limitation array
    public function assignRole($contentId, $roleId, array $limitation)
    {
        foreach ($limitation as $identifier => $values) {
            foreach ($values as $value) {
                $query = $this->handler->createInsertQuery();
                $query->insertInto($this->handler->quoteTable('ezuser_role'))->set($this->handler->quoteColumn('contentobject_id'), $query->bindValue($contentId, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('role_id'), $query->bindValue($roleId, null, \PDO::PARAM_INT))->set($this->handler->quoteColumn('limit_identifier'), $query->bindValue($identifier))->set($this->handler->quoteColumn('limit_value'), $query->bindValue($value));
                $query->prepare()->execute();
            }
        }
    }