Assembly Listenübersicht umsetzen

This commit is contained in:
Marcel Diegelmann 2025-07-03 13:47:20 +02:00
parent 36e9939419
commit 10e6fb48f3
27 changed files with 2511 additions and 9 deletions

View file

@ -23,15 +23,22 @@ declare(strict_types=1);
namespace App\Controller;
use App\DataTables\AssemblyBomEntriesDataTable;
use App\DataTables\AssemblyDataTable;
use App\DataTables\ErrorDataTable;
use App\DataTables\Filters\AssemblyFilter;
use App\Entity\AssemblySystem\Assembly;
use App\Entity\AssemblySystem\AssemblyBOMEntry;
use App\Entity\Parts\Part;
use App\Exceptions\InvalidRegexException;
use App\Form\AssemblySystem\AssemblyAddPartsType;
use App\Form\AssemblySystem\AssemblyBuildType;
use App\Form\Filters\AssemblyFilterType;
use App\Helpers\Assemblies\AssemblyBuildRequest;
use App\Services\ImportExportSystem\BOMImporter;
use App\Services\AssemblySystem\AssemblyBuildHelper;
use App\Services\Trees\NodesListBuilder;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\DBAL\Exception\DriverException;
use Doctrine\ORM\EntityManagerInterface;
use League\Csv\SyntaxError;
use Omines\DataTablesBundle\DataTableFactory;
@ -54,9 +61,76 @@ class AssemblyController extends AbstractController
public function __construct(
private readonly DataTableFactory $dataTableFactory,
private readonly TranslatorInterface $translator,
private readonly NodesListBuilder $nodesListBuilder
) {
}
#[Route(path: '/list', name: 'assemblies_list')]
public function showAll(Request $request): Response
{
return $this->showListWithFilter($request,'assemblies/lists/all_list.html.twig');
}
/**
* Common implementation for the part list pages.
* @param Request $request The request to parse
* @param string $template The template that should be rendered
* @param callable|null $filter_changer A function that is called with the filter object as parameter. This function can be used to customize the filter
* @param callable|null $form_changer A function that is called with the form object as parameter. This function can be used to customize the form
* @param array $additonal_template_vars Any additional template variables that should be passed to the template
* @param array $additional_table_vars Any additional variables that should be passed to the table creation
*/
protected function showListWithFilter(Request $request, string $template, ?callable $filter_changer = null, ?callable $form_changer = null, array $additonal_template_vars = [], array $additional_table_vars = []): Response
{
$this->denyAccessUnlessGranted('@assemblies.read');
$formRequest = clone $request;
$formRequest->setMethod('GET');
$filter = new AssemblyFilter($this->nodesListBuilder);
if($filter_changer !== null){
$filter_changer($filter);
}
$filterForm = $this->createForm(AssemblyFilterType::class, $filter, ['method' => 'GET']);
if($form_changer !== null) {
$form_changer($filterForm);
}
$filterForm->handleRequest($formRequest);
$table = $this->dataTableFactory->createFromType(
AssemblyDataTable::class,
array_merge(['filter' => $filter], $additional_table_vars),
['lengthMenu' => AssemblyDataTable::LENGTH_MENU]
)
->handleRequest($request);
if ($table->isCallback()) {
try {
try {
return $table->getResponse();
} catch (DriverException $driverException) {
if ($driverException->getCode() === 1139) {
//Convert the driver exception to InvalidRegexException so it has the same handler as for SQLite
throw InvalidRegexException::fromDriverException($driverException);
} else {
throw $driverException;
}
}
} catch (InvalidRegexException $exception) {
$errors = $this->translator->trans('assembly.table.invalid_regex').': '.$exception->getReason();
$request->request->set('order', []);
return ErrorDataTable::errorTable($this->dataTableFactory, $request, $errors);
}
}
return $this->render($template, array_merge([
'datatable' => $table,
'filterForm' => $filterForm->createView(),
], $additonal_template_vars));
}
#[Route(path: '/{id}/info', name: 'assembly_info', requirements: ['id' => '\d+'])]
public function info(Assembly $assembly, Request $request, AssemblyBuildHelper $buildHelper): Response
{

View file

@ -0,0 +1,249 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2022 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\DataTables;
use App\DataTables\Adapters\TwoStepORMAdapter;
use App\DataTables\Column\IconLinkColumn;
use App\DataTables\Column\LocaleDateTimeColumn;
use App\DataTables\Column\MarkdownColumn;
use App\DataTables\Column\SelectColumn;
use App\DataTables\Filters\AssemblyFilter;
use App\DataTables\Filters\AssemblySearchFilter;
use App\DataTables\Helpers\AssemblyDataTableHelper;
use App\DataTables\Helpers\ColumnSortHelper;
use App\Doctrine\Helpers\FieldHelper;
use App\Entity\AssemblySystem\Assembly;
use App\Services\EntityURLGenerator;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\QueryBuilder;
use Omines\DataTablesBundle\Adapter\Doctrine\ORM\SearchCriteriaProvider;
use Omines\DataTablesBundle\Column\TextColumn;
use Omines\DataTablesBundle\DataTable;
use Omines\DataTablesBundle\DataTableTypeInterface;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Contracts\Translation\TranslatorInterface;
final class AssemblyDataTable implements DataTableTypeInterface
{
const LENGTH_MENU = [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]];
public function __construct(
private readonly EntityURLGenerator $urlGenerator,
private readonly TranslatorInterface $translator,
private readonly AssemblyDataTableHelper $assemblyDataTableHelper,
private readonly Security $security,
private readonly string $visible_columns,
private readonly ColumnSortHelper $csh,
) {
}
public function configureOptions(OptionsResolver $optionsResolver): void
{
$optionsResolver->setDefaults([
'filter' => null,
'search' => null
]);
$optionsResolver->setAllowedTypes('filter', [AssemblyFilter::class, 'null']);
$optionsResolver->setAllowedTypes('search', [AssemblySearchFilter::class, 'null']);
}
public function configure(DataTable $dataTable, array $options): void
{
$resolver = new OptionsResolver();
$this->configureOptions($resolver);
$options = $resolver->resolve($options);
$this->csh
->add('select', SelectColumn::class, visibility_configurable: false)
->add('picture', TextColumn::class, [
'label' => '',
'className' => 'no-colvis',
'render' => fn($value, Assembly $context) => $this->assemblyDataTableHelper->renderPicture($context),
], visibility_configurable: false)
->add('name', TextColumn::class, [
'label' => $this->translator->trans('assembly.table.name'),
'render' => fn($value, Assembly $context) => $this->assemblyDataTableHelper->renderName($context),
'orderField' => 'NATSORT(assembly.name)'
])
->add('id', TextColumn::class, [
'label' => $this->translator->trans('assembly.table.id'),
])
->add('ipn', TextColumn::class, [
'label' => $this->translator->trans('assembly.table.ipn'),
'orderField' => 'NATSORT(assembly.ipn)'
])
->add('description', MarkdownColumn::class, [
'label' => $this->translator->trans('assembly.table.description'),
])
->add('addedDate', LocaleDateTimeColumn::class, [
'label' => $this->translator->trans('assembly.table.addedDate'),
])
->add('lastModified', LocaleDateTimeColumn::class, [
'label' => $this->translator->trans('assembly.table.lastModified'),
]);
//Add a assembly column to list where the assembly is used as referenced assembly as bom-entry, when the user has the permission to see the assemblies
if ($this->security->isGranted('read', Assembly::class)) {
$this->csh->add('referencedAssemblies', TextColumn::class, [
'label' => $this->translator->trans('assembly.referencedAssembly.labelp'),
'render' => function ($value, Assembly $context): string {
$assemblies = $context->getReferencedAssemblies();
$max = 5;
$tmp = "";
for ($i = 0; $i < min($max, count($assemblies)); $i++) {
$url = $this->urlGenerator->infoURL($assemblies[$i]);
$tmp .= sprintf('<a href="%s">%s</a>', $url, htmlspecialchars($assemblies[$i]->getName()));
if ($i < count($assemblies) - 1) {
$tmp .= ", ";
}
}
if (count($assemblies) > $max) {
$tmp .= ", + ".(count($assemblies) - $max);
}
return $tmp;
}
]);
}
$this->csh
->add('edit', IconLinkColumn::class, [
'label' => $this->translator->trans('assembly.table.edit'),
'href' => fn($value, Assembly $context) => $this->urlGenerator->editURL($context),
'disabled' => fn($value, Assembly $context) => !$this->security->isGranted('edit', $context),
'title' => $this->translator->trans('assembly.table.edit.title'),
]);
//Apply the user configured order and visibility and add the columns to the table
$this->csh->applyVisibilityAndConfigureColumns($dataTable, $this->visible_columns, "TABLE_ASSEMBLIES_DEFAULT_COLUMNS");
$dataTable->addOrderBy('name')
->createAdapter(TwoStepORMAdapter::class, [
'filter_query' => $this->getFilterQuery(...),
'detail_query' => $this->getDetailQuery(...),
'entity' => Assembly::class,
'hydrate' => AbstractQuery::HYDRATE_OBJECT,
//Use the simple total query, as we just want to get the total number of assemblies without any conditions
//For this the normal query would be pretty slow
'simple_total_query' => true,
'criteria' => [
function (QueryBuilder $builder) use ($options): void {
$this->buildCriteria($builder, $options);
},
new SearchCriteriaProvider(),
],
'query_modifier' => $this->addJoins(...),
]);
}
private function getFilterQuery(QueryBuilder $builder): void
{
/* In the filter query we only select the IDs. The fetching of the full entities is done in the detail query.
* We only need to join the entities here, so we can filter by them.
* The filter conditions are added to this QB in the buildCriteria method.
*
* The amountSum field and the joins are dynamically added by the addJoins method, if the fields are used in the query.
* This improves the performance, as we do not need to join all tables, if we do not need them.
*/
$builder
->select('assembly.id')
->from(Assembly::class, 'assembly')
//The other group by fields, are dynamically added by the addJoins method
->addGroupBy('assembly');
}
private function getDetailQuery(QueryBuilder $builder, array $filter_results): void
{
$ids = array_map(static fn($row) => $row['id'], $filter_results);
/*
* In this query we take the IDs which were filtered, paginated and sorted in the filter query, and fetch the
* full entities.
* We can do complex fetch joins, as we do not need to filter or sort here (which would kill the performance).
* The only condition should be for the IDs.
* It is important that elements are ordered the same way, as the IDs are passed, or ordering will be wrong.
*
* We do not require the subqueries like amountSum here, as it is not used to render the table (and only for sorting)
*/
$builder
->select('assembly')
->addSelect('master_picture_attachment')
->addSelect('attachments')
->from(Assembly::class, 'assembly')
->leftJoin('assembly.master_picture_attachment', 'master_picture_attachment')
->leftJoin('assembly.attachments', 'attachments')
->where('assembly.id IN (:ids)')
->setParameter('ids', $ids)
->addGroupBy('assembly')
->addGroupBy('master_picture_attachment')
->addGroupBy('attachments');
//Get the results in the same order as the IDs were passed
FieldHelper::addOrderByFieldParam($builder, 'assembly.id', 'ids');
}
/**
* This function is called right before the filter query is executed.
* We use it to dynamically add joins to the query, if the fields are used in the query.
* @param QueryBuilder $builder
* @return QueryBuilder
*/
private function addJoins(QueryBuilder $builder): QueryBuilder
{
//Check if the query contains certain conditions, for which we need to add additional joins
//The join fields get prefixed with an underscore, so we can check if they are used in the query easy without confusing them for a assembly subfield
$dql = $builder->getDQL();
if (str_contains($dql, '_master_picture_attachment')) {
$builder->leftJoin('assembly.master_picture_attachment', '_master_picture_attachment');
$builder->addGroupBy('_master_picture_attachment');
}
if (str_contains($dql, '_attachments')) {
$builder->leftJoin('assembly.attachments', '_attachments');
}
return $builder;
}
private function buildCriteria(QueryBuilder $builder, array $options): void
{
//Apply the search criterias first
if ($options['search'] instanceof AssemblySearchFilter) {
$search = $options['search'];
$search->apply($builder);
}
//We do the most stuff here in the filter class
if ($options['filter'] instanceof AssemblyFilter) {
$filter = $options['filter'];
$filter->apply($builder);
}
}
}

View file

@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2022 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/>.
*/
namespace App\DataTables\Filters;
use App\DataTables\Filters\Constraints\DateTimeConstraint;
use App\DataTables\Filters\Constraints\EntityConstraint;
use App\DataTables\Filters\Constraints\IntConstraint;
use App\DataTables\Filters\Constraints\TextConstraint;
use App\Entity\Attachments\AttachmentType;
use App\Services\Trees\NodesListBuilder;
use Doctrine\ORM\QueryBuilder;
class AssemblyFilter implements FilterInterface
{
use CompoundFilterTrait;
public readonly IntConstraint $dbId;
public readonly TextConstraint $ipn;
public readonly TextConstraint $name;
public readonly TextConstraint $description;
public readonly TextConstraint $comment;
public readonly DateTimeConstraint $lastModified;
public readonly DateTimeConstraint $addedDate;
public readonly IntConstraint $attachmentsCount;
public readonly EntityConstraint $attachmentType;
public readonly TextConstraint $attachmentName;
public function __construct(NodesListBuilder $nodesListBuilder)
{
$this->name = new TextConstraint('assembly.name');
$this->description = new TextConstraint('assembly.description');
$this->comment = new TextConstraint('assembly.comment');
$this->dbId = new IntConstraint('assembly.id');
$this->ipn = new TextConstraint('assembly.ipn');
$this->addedDate = new DateTimeConstraint('assembly.addedDate');
$this->lastModified = new DateTimeConstraint('assembly.lastModified');
$this->attachmentsCount = new IntConstraint('COUNT(_attachments)');
$this->attachmentType = new EntityConstraint($nodesListBuilder, AttachmentType::class, '_attachments.attachment_type');
$this->attachmentName = new TextConstraint('_attachments.name');
}
public function apply(QueryBuilder $queryBuilder): void
{
$this->applyAllChildFilters($queryBuilder);
}
}

View file

@ -0,0 +1,183 @@
<?php
declare(strict_types=1);
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2022 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/>.
*/
namespace App\DataTables\Filters;
use Doctrine\ORM\QueryBuilder;
class AssemblySearchFilter implements FilterInterface
{
/** @var boolean Whether to use regex for searching */
protected bool $regex = false;
/** @var bool Use name field for searching */
protected bool $name = true;
/** @var bool Use description for searching */
protected bool $description = true;
/** @var bool Use comment field for searching */
protected bool $comment = true;
/** @var bool Use ordernr for searching */
protected bool $ordernr = true;
/** @var bool Use Internal part number for searching */
protected bool $ipn = true;
public function __construct(
/** @var string The string to query for */
protected string $keyword
)
{
}
protected function getFieldsToSearch(): array
{
$fields_to_search = [];
if($this->name) {
$fields_to_search[] = 'assembly.name';
}
if($this->description) {
$fields_to_search[] = 'assembly.description';
}
if ($this->comment) {
$fields_to_search[] = 'assembly.comment';
}
if ($this->ipn) {
$fields_to_search[] = 'assembly.ipn';
}
return $fields_to_search;
}
public function apply(QueryBuilder $queryBuilder): void
{
$fields_to_search = $this->getFieldsToSearch();
//If we have nothing to search for, do nothing
if ($fields_to_search === [] || $this->keyword === '') {
return;
}
//Convert the fields to search to a list of expressions
$expressions = array_map(function (string $field): string {
if ($this->regex) {
return sprintf("REGEXP(%s, :search_query) = TRUE", $field);
}
return sprintf("ILIKE(%s, :search_query) = TRUE", $field);
}, $fields_to_search);
//Add Or concatenation of the expressions to our query
$queryBuilder->andWhere(
$queryBuilder->expr()->orX(...$expressions)
);
//For regex, we pass the query as is, for like we add % to the start and end as wildcards
if ($this->regex) {
$queryBuilder->setParameter('search_query', $this->keyword);
} else {
$queryBuilder->setParameter('search_query', '%' . $this->keyword . '%');
}
}
public function getKeyword(): string
{
return $this->keyword;
}
public function setKeyword(string $keyword): AssemblySearchFilter
{
$this->keyword = $keyword;
return $this;
}
public function isRegex(): bool
{
return $this->regex;
}
public function setRegex(bool $regex): AssemblySearchFilter
{
$this->regex = $regex;
return $this;
}
public function isName(): bool
{
return $this->name;
}
public function setName(bool $name): AssemblySearchFilter
{
$this->name = $name;
return $this;
}
public function isCategory(): bool
{
return $this->category;
}
public function setCategory(bool $category): AssemblySearchFilter
{
$this->category = $category;
return $this;
}
public function isDescription(): bool
{
return $this->description;
}
public function setDescription(bool $description): AssemblySearchFilter
{
$this->description = $description;
return $this;
}
public function isIPN(): bool
{
return $this->ipn;
}
public function setIPN(bool $ipn): AssemblySearchFilter
{
$this->ipn = $ipn;
return $this;
}
public function isComment(): bool
{
return $this->comment;
}
public function setComment(bool $comment): AssemblySearchFilter
{
$this->comment = $comment;
return $this;
}
}

View file

@ -0,0 +1,77 @@
<?php
declare(strict_types=1);
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2022 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/>.
*/
namespace App\DataTables\Helpers;
use App\Entity\AssemblySystem\Assembly;
use App\Entity\Attachments\Attachment;
use App\Services\Attachments\AssemblyPreviewGenerator;
use App\Services\Attachments\AttachmentURLGenerator;
use App\Services\EntityURLGenerator;
/**
* A helper service which contains common code to render columns for assembly related tables
*/
class AssemblyDataTableHelper
{
public function __construct(
private readonly EntityURLGenerator $entityURLGenerator,
private readonly AssemblyPreviewGenerator $previewGenerator,
private readonly AttachmentURLGenerator $attachmentURLGenerator
) {
}
public function renderName(Assembly $context): string
{
$icon = '';
return sprintf(
'<a href="%s">%s%s</a>',
$this->entityURLGenerator->infoURL($context),
$icon,
htmlspecialchars($context->getName())
);
}
public function renderPicture(Assembly $context): string
{
$preview_attachment = $this->previewGenerator->getTablePreviewAttachment($context);
if (!$preview_attachment instanceof Attachment) {
return '';
}
$title = htmlspecialchars($preview_attachment->getName());
if ($preview_attachment->getFilename()) {
$title .= ' ('.htmlspecialchars($preview_attachment->getFilename()).')';
}
return sprintf(
'<img alt="%s" src="%s" data-thumbnail="%s" class="%s" data-title="%s" data-controller="elements--hoverpic">',
'Assembly image',
$this->attachmentURLGenerator->getThumbnailURL($preview_attachment),
$this->attachmentURLGenerator->getThumbnailURL($preview_attachment, 'thumbnail_md'),
'hoverpic assembly-table-image',
$title
);
}
}

View file

@ -27,7 +27,7 @@ use App\Entity\ProjectSystem\Project;
use App\Services\EntityURLGenerator;
/**
* A helper service which contains common code to render columns for assembly related tables
* A helper service which contains common code to render columns for project related tables
*/
class ProjectDataTableHelper
{

View file

@ -0,0 +1,114 @@
<?php
declare(strict_types=1);
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2022 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/>.
*/
namespace App\Form\Filters;
use App\DataTables\Filters\AssemblyFilter;
use App\Entity\Attachments\AttachmentType;
use App\Form\Filters\Constraints\DateTimeConstraintType;
use App\Form\Filters\Constraints\NumberConstraintType;
use App\Form\Filters\Constraints\StructuralEntityConstraintType;
use App\Form\Filters\Constraints\TextConstraintType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ResetType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class AssemblyFilterType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'compound' => true,
'data_class' => AssemblyFilter::class,
'csrf_protection' => false,
]);
}
public function buildForm(FormBuilderInterface $builder, array $options): void
{
/*
* Common tab
*/
$builder->add('name', TextConstraintType::class, [
'label' => 'assembly.filter.name',
]);
$builder->add('description', TextConstraintType::class, [
'label' => 'assembly.filter.description',
]);
$builder->add('comment', TextConstraintType::class, [
'label' => 'assembly.filter.comment'
]);
/*
* Advanced tab
*/
$builder->add('dbId', NumberConstraintType::class, [
'label' => 'assembly.filter.dbId',
'min' => 1,
'step' => 1,
]);
$builder->add('ipn', TextConstraintType::class, [
'label' => 'assembly.filter.ipn',
]);
$builder->add('lastModified', DateTimeConstraintType::class, [
'label' => 'lastModified'
]);
$builder->add('addedDate', DateTimeConstraintType::class, [
'label' => 'createdAt'
]);
/**
* Attachments count
*/
$builder->add('attachmentsCount', NumberConstraintType::class, [
'label' => 'assembly.filter.attachments_count',
'step' => 1,
'min' => 0,
]);
$builder->add('attachmentType', StructuralEntityConstraintType::class, [
'label' => 'attachment.attachment_type',
'entity_class' => AttachmentType::class
]);
$builder->add('attachmentName', TextConstraintType::class, [
'label' => 'assembly.filter.attachmentName',
]);
$builder->add('submit', SubmitType::class, [
'label' => 'filter.submit',
]);
$builder->add('discard', ResetType::class, [
'label' => 'filter.discard',
]);
}
}