Renamed the base DBElement classes to AbstractDBElement to comply with symfony recommendations.

This commit is contained in:
Jan Böhmer 2020-02-01 19:48:07 +01:00
parent da72f5b3ec
commit 594c694ee0
62 changed files with 203 additions and 203 deletions

View file

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use App\Services\Attachments\FileTypeFilterTools;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\CallbackTransformer;
@ -42,7 +42,7 @@ class AttachmentTypeAdminForm extends BaseEntityAdminForm
parent::__construct($security, $params);
}
protected function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity): void
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
{
$is_new = null === $entity->getID();

View file

@ -25,8 +25,8 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
use App\Entity\Attachments\Attachment;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\StructuralDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Form\AttachmentFormType;
use App\Form\Type\MasterPictureAttachmentType;
use App\Form\Type\StructuralEntityType;
@ -62,7 +62,7 @@ class BaseEntityAdminForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options): void
{
/** @var StructuralDBElement $entity */
/** @var AbstractStructuralDBElement $entity */
$entity = $options['data'];
$is_new = null === $entity->getID();
@ -140,7 +140,7 @@ class BaseEntityAdminForm extends AbstractType
]);
}
protected function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity): void
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
{
//Empty for Base
}

View file

@ -24,14 +24,14 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
class CategoryAdminForm extends BaseEntityAdminForm
{
protected function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity): void
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
{
$is_new = null === $entity->getID();

View file

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TelType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
@ -33,7 +33,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class CompanyForm extends BaseEntityAdminForm
{
protected function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity): void
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
{
$is_new = null === $entity->getID();

View file

@ -24,14 +24,14 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\FormBuilderInterface;
class CurrencyAdminForm extends BaseEntityAdminForm
{
protected function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity): void
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
{
$is_new = null === $entity->getID();

View file

@ -24,13 +24,13 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use App\Form\Type\MasterPictureAttachmentType;
use Symfony\Component\Form\FormBuilderInterface;
class FootprintAdminForm extends BaseEntityAdminForm
{
public function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity): void
public function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
{
$builder->add('footprint_3d', MasterPictureAttachmentType::class, [
'required' => false,

View file

@ -24,14 +24,14 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use App\Form\Permissions\PermissionsType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\FormBuilderInterface;
class GroupAdminForm extends BaseEntityAdminForm
{
protected function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity): void
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
{
$is_new = null === $entity->getID();

View file

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
use App\Entity\Base\StructuralDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Form\Type\StructuralEntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
@ -71,7 +71,7 @@ class ImportType extends AbstractType
'disabled' => $disabled,
]);
if ($entity instanceof StructuralDBElement) {
if ($entity instanceof AbstractStructuralDBElement) {
$builder->add('parent', StructuralEntityType::class, [
'class' => $data['entity_class'],
'required' => false,

View file

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
use App\Entity\Base\StructuralDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Form\Type\StructuralEntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
@ -61,7 +61,7 @@ class MassCreationForm extends AbstractType
'rows' => 10,
],
]);
if ($entity instanceof StructuralDBElement) {
if ($entity instanceof AbstractStructuralDBElement) {
$builder->add('parent', StructuralEntityType::class, [
'class' => $data['entity_class'],
'required' => false,

View file

@ -24,14 +24,14 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
class MeasurementUnitAdminForm extends BaseEntityAdminForm
{
protected function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity): void
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
{
$is_new = null === $entity->getID();

View file

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\Parts\MeasurementUnit;
use App\Form\Type\StructuralEntityType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
@ -32,7 +32,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class StorelocationAdminForm extends BaseEntityAdminForm
{
protected function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity): void
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
{
$is_new = null === $entity->getID();

View file

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace App\Form\AdminPages;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\PriceInformations\Currency;
use App\Form\Type\StructuralEntityType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
@ -32,7 +32,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class SupplierForm extends CompanyForm
{
protected function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity): void
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
{
$is_new = null === $entity->getID();

View file

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace App\Form\Type;
use App\Entity\Base\StructuralDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\PriceInformations\Currency;
use App\Services\Trees\NodesListBuilder;
use Doctrine\ORM\EntityManagerInterface;
@ -65,7 +65,7 @@ class CurrencyEntityType extends StructuralEntityType
});
}
public function generateChoiceLabels(StructuralDBElement $choice, $key, $value): string
public function generateChoiceLabels(AbstractStructuralDBElement $choice, $key, $value): string
{
//Similar to StructuralEntityType, but we use the currency symbol instead if available
@ -73,7 +73,7 @@ class CurrencyEntityType extends StructuralEntityType
throw new \InvalidArgumentException('$choice must be an currency object!');
}
/** @var StructuralDBElement|null $parent */
/** @var AbstractStructuralDBElement|null $parent */
$parent = $this->options['subentities_of'];
/*** @var Currency $choice */
@ -93,7 +93,7 @@ class CurrencyEntityType extends StructuralEntityType
return $tmp;
}
protected function generateChoiceAttr(StructuralDBElement $choice, $key, $value): array
protected function generateChoiceAttr(AbstractStructuralDBElement $choice, $key, $value): array
{
/** @var Currency $choice */
$tmp = [];

View file

@ -25,7 +25,7 @@ declare(strict_types=1);
namespace App\Form\Type;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Base\StructuralDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Repository\StructuralDBElementRepository;
use App\Services\Trees\NodesListBuilder;
use Doctrine\ORM\EntityManagerInterface;
@ -221,7 +221,7 @@ class StructuralEntityType extends AbstractType
return $this->em->find($options['class'], $value->getID());
}
protected function generateChoiceAttr(StructuralDBElement $choice, $key, $value): array
protected function generateChoiceAttr(AbstractStructuralDBElement $choice, $key, $value): array
{
$tmp = [];
@ -241,12 +241,12 @@ class StructuralEntityType extends AbstractType
return $tmp;
}
protected function generateChoiceLabels(StructuralDBElement $choice, $key, $value): string
protected function generateChoiceLabels(AbstractStructuralDBElement $choice, $key, $value): string
{
/** @var StructuralDBElement|null $parent */
/** @var AbstractStructuralDBElement|null $parent */
$parent = $this->options['subentities_of'];
/*** @var StructuralDBElement $choice */
/*** @var AbstractStructuralDBElement $choice */
$level = $choice->getLevel();
//If our base entity is not the root level, we need to change the level, to get zero position
if (null !== $this->options['subentities_of']) {

View file

@ -24,8 +24,8 @@ declare(strict_types=1);
namespace App\Form;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\StructuralDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\Base\AbstractStructuralDBElement;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
use App\Form\Permissions\PermissionsType;
@ -65,7 +65,7 @@ class UserAdminForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options): void
{
/** @var StructuralDBElement $entity */
/** @var AbstractStructuralDBElement $entity */
$entity = $options['data'];
$is_new = null === $entity->getID();
@ -244,7 +244,7 @@ class UserAdminForm extends AbstractType
]);
}
protected function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity): void
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
{
//Empty for Base
}