Added basic ability to store EDA Data in a Part

But that might change, as it is currently not ideal
This commit is contained in:
Jan Böhmer 2023-11-30 12:54:30 +01:00
parent 2ec1a10623
commit d5f002ac20
12 changed files with 398 additions and 1 deletions

View file

@ -0,0 +1,56 @@
<?php
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2023 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace App\Form\Part;
use App\Entity\EDA\EDAPartInfo;
use App\Entity\Parts\PartAssociation;
use App\Form\Type\TriStateCheckboxType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class EDAPartInfoType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('reference_prefix', TextType::class)
->add('value', TextType::class)
->add('invisible', TriStateCheckboxType::class)
->add('exclude_from_bom', TriStateCheckboxType::class)
->add('exclude_from_board', TriStateCheckboxType::class)
->add('exclude_from_sim', TriStateCheckboxType::class)
->add('kicad_symbol', TextType::class)
->add('kicad_footprint', TextType::class)
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => EDAPartInfo::class,
]);
}
}

View file

@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Form\Part;
use App\Entity\EDA\EDAPartInfo;
use App\Entity\Parts\ManufacturingStatus;
use App\Services\InfoProviderSystem\DTOs\PartDetailDTO;
use Symfony\Bundle\SecurityBundle\Security;
@ -255,6 +256,13 @@ class PartBaseType extends AbstractType
'by_reference' => false,
]);
//EDA info
$builder->add('eda_info', EDAPartInfoType::class, [
'label' => false,
'required' => false,
'setter' => fn (Part $part, ?EDAPartInfo $x) => $part->setEdaInfo($x),
]);
$builder->add('log_comment', TextType::class, [
'label' => 'edit.log_comment',
'mapped' => false,