mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-05 15:10:16 +02:00
bcd6a157a8
CI / Tests (push) Failing after 1m8s
CI / Build and deploy to ${{ startsWith(github.ref, 'refs/tags/') && 'production' || (github.ref == 'refs/heads/main' && 'acceptance' || '') }} (push) Has been skipped
* Some tests * More tests! * Tests 3 * Move getScores from Candidate to Quiz * Add some suggestions for future refactoring * - **Add Gedmo doctrine-extensions and Stof bundle integration** - Added `stof/doctrine-extensions-bundle` and `gedmo/doctrine-extensions` dependencies. - Integrated `Timestampable` behavior for `Created` fields in entities. - Updated `bundles.php` to register StofDoctrineExtensionsBundle. - Added configuration for the Stof bundle. - Simplified `SeasonVoter` with `match` expression and added new tests. - Minor fixes and adjustments across various files. * WIP * All the tests * Base64 tests * Symfomny 7.4.0 * Update * Update recipe * PHP 8.5 * Rector changes * More 8.5 * Things
37 lines
859 B
PHP
37 lines
859 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tvdt\Command;
|
|
|
|
use Symfony\Component\Console\Attribute\Argument;
|
|
use Symfony\Component\Console\Attribute\AsCommand;
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
|
use Tvdt\Repository\UserRepository;
|
|
|
|
#[AsCommand(
|
|
name: 'tvdt:make-admin',
|
|
description: 'Give a user the role admin',
|
|
)]
|
|
final readonly class MakeAdminCommand
|
|
{
|
|
public function __construct(private UserRepository $userRepository) {}
|
|
|
|
public function __invoke(
|
|
#[Argument]
|
|
string $email,
|
|
SymfonyStyle $io,
|
|
): int {
|
|
try {
|
|
$this->userRepository->makeAdmin($email);
|
|
} catch (\InvalidArgumentException) {
|
|
$io->error('User not found');
|
|
|
|
return Command::FAILURE;
|
|
}
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
}
|