Save element parameters in its own database table (dont use JSON)

This makes it easier to query for specific parameters.
This commit is contained in:
Jan Böhmer 2020-03-11 21:48:47 +01:00
parent a6e0f1738b
commit 719e21c0df
35 changed files with 738 additions and 183 deletions

View file

@ -20,14 +20,15 @@
namespace App\Form;
use App\Entity\Specifications\Specification;
use App\Entity\Parameters\AbstractParameter;
use App\Entity\Parameters\Parameter;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class SpecificationType extends AbstractType
class ParameterType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
@ -61,7 +62,7 @@ class SpecificationType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Specification::class
'data_class' => AbstractParameter::class
]);
}
}

View file

@ -44,15 +44,16 @@ namespace App\Form\Part;
use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\PartAttachment;
use App\Entity\Parameters\PartParameter;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\PriceInformations\Orderdetail;
use App\Entity\Specifications\Specification;
use App\Entity\Parameters\Parameter;
use App\Form\AttachmentFormType;
use App\Form\SpecificationType;
use App\Form\ParameterType;
use App\Form\Type\MasterPictureAttachmentType;
use App\Form\Type\SIUnitType;
use App\Form\Type\StructuralEntityType;
@ -266,13 +267,16 @@ class PartBaseType extends AbstractType
],
]);
$builder->add('specifications', CollectionType::class, [
'entry_type' => SpecificationType::class,
$builder->add('parameters', CollectionType::class, [
'entry_type' => ParameterType::class,
'allow_add' => true,
'allow_delete' => true,
'label' => false,
'by_reference' => false,
'prototype_data' => new Specification(),
'prototype_data' => new PartParameter(),
'entry_options' => [
'data_class' => PartParameter::class
]
]);
$builder->add('log_comment', TextType::class, [