Correct AbstractEntityCommand and correct small mistakes

This commit is contained in:
Tim 2022-09-24 01:58:55 +02:00
parent 941e3cdc9c
commit 1888923d28
4 changed files with 2797 additions and 9 deletions

View File

@ -10,6 +10,7 @@
}, },
"require": { "require": {
"symfony/http-kernel": "^6.1", "symfony/http-kernel": "^6.1",
"symfony/console": "^6.1" "symfony/console": "^6.1",
"symfony/orm-pack": "^2.2"
} }
} }

2793
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,8 @@
<?php <?php
namespace Ardent\UtilBundle\Command; namespace Ardent\UtilBundle\EntityBuilder;
use App\Entity\Configuration;
use Ardent\UtilBundle\EntityBuilder\Builder;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Exception; use Exception;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
@ -68,7 +65,7 @@ abstract class AbstractEntityCommand extends Command
$entity = $this->select($io, $id); $entity = $this->select($io, $id);
$table = $io->createTable(); $table = $io->createTable();
$table->setHeaders(['property', 'value']); $table->setHeaders(['property', 'value']);
$table->setRows($builder->getAllproperties($entity)); $table->setRows($builder->getAllProperties($entity));
$table->setHeaderTitle(sprintf('id: %s', $entity->getId())); $table->setHeaderTitle(sprintf('id: %s', $entity->getId()));
$table->render(); $table->render();
} else { } else {

View File

@ -13,7 +13,6 @@ class Builder
*/ */
private array $elements = []; private array $elements = [];
public function __construct( public function __construct(
private readonly SymfonyStyle $io, private readonly SymfonyStyle $io,
) )
@ -59,7 +58,7 @@ class Builder
$this->setProperty($object, $element); $this->setProperty($object, $element);
} }
public function getAllproperties(object $object): array public function getAllProperties(object $object): array
{ {
$data = []; $data = [];
foreach ($this->elements as $element) { foreach ($this->elements as $element) {