@@ -117,19 +117,19 @@ |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | //Ensure we have an valid operator |
120 | - if(!in_array($this->operator, self::ALLOWED_OPERATOR_VALUES, true)) { |
|
121 | - throw new \RuntimeException('Invalid operator '. $this->operator . ' provided. Valid operators are '. implode(', ', self::ALLOWED_OPERATOR_VALUES)); |
|
120 | + if (!in_array($this->operator, self::ALLOWED_OPERATOR_VALUES, true)) { |
|
121 | + throw new \RuntimeException('Invalid operator '.$this->operator.' provided. Valid operators are '.implode(', ', self::ALLOWED_OPERATOR_VALUES)); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | if ($this->operator !== 'BETWEEN') { |
125 | 125 | $this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier, $this->operator, $this->value1); |
126 | - } else { |
|
126 | + } else { |
|
127 | 127 | if ($this->value2 === null) { |
128 | 128 | throw new RuntimeException("Cannot use operator BETWEEN without value2!"); |
129 | 129 | } |
130 | 130 | |
131 | - $this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier . '1', '>=', $this->value1); |
|
132 | - $this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier . '2', '<=', $this->value2); |
|
131 | + $this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier.'1', '>=', $this->value1); |
|
132 | + $this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier.'2', '<=', $this->value2); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
136 | 136 | \ No newline at end of file |
@@ -123,7 +123,7 @@ |
||
123 | 123 | |
124 | 124 | if ($this->operator !== 'BETWEEN') { |
125 | 125 | $this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier, $this->operator, $this->value1); |
126 | - } else { |
|
126 | + } else { |
|
127 | 127 | if ($this->value2 === null) { |
128 | 128 | throw new RuntimeException("Cannot use operator BETWEEN without value2!"); |
129 | 129 | } |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | //Ensure we have an valid operator |
90 | - if(!in_array($this->operator, self::ALLOWED_OPERATOR_VALUES, true)) { |
|
91 | - throw new \RuntimeException('Invalid operator '. $this->operator . ' provided. Valid operators are '. implode(', ', self::ALLOWED_OPERATOR_VALUES)); |
|
90 | + if (!in_array($this->operator, self::ALLOWED_OPERATOR_VALUES, true)) { |
|
91 | + throw new \RuntimeException('Invalid operator '.$this->operator.' provided. Valid operators are '.implode(', ', self::ALLOWED_OPERATOR_VALUES)); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | if ($this->operator === 'ANY') { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } elseif ($this->operator === 'NONE') { |
97 | 97 | $this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier, 'NOT IN', $this->value); |
98 | 98 | } else { |
99 | - throw new \RuntimeException('Unknown operator '. $this->operator . ' provided. Valid operators are '. implode(', ', self::ALLOWED_OPERATOR_VALUES)); |
|
99 | + throw new \RuntimeException('Unknown operator '.$this->operator.' provided. Valid operators are '.implode(', ', self::ALLOWED_OPERATOR_VALUES)); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | 103 | \ No newline at end of file |
@@ -74,34 +74,34 @@ discard block |
||
74 | 74 | { |
75 | 75 | $fields_to_search = []; |
76 | 76 | |
77 | - if($this->name) { |
|
77 | + if ($this->name) { |
|
78 | 78 | $fields_to_search[] = 'part.name'; |
79 | 79 | } |
80 | - if($this->category) { |
|
80 | + if ($this->category) { |
|
81 | 81 | $fields_to_search[] = 'category.name'; |
82 | 82 | } |
83 | - if($this->description) { |
|
83 | + if ($this->description) { |
|
84 | 84 | $fields_to_search[] = 'part.description'; |
85 | 85 | } |
86 | - if($this->tags) { |
|
86 | + if ($this->tags) { |
|
87 | 87 | $fields_to_search[] = 'part.tags'; |
88 | 88 | } |
89 | - if($this->storelocation) { |
|
89 | + if ($this->storelocation) { |
|
90 | 90 | $fields_to_search[] = 'storelocations.name'; |
91 | 91 | } |
92 | - if($this->ordernr) { |
|
92 | + if ($this->ordernr) { |
|
93 | 93 | $fields_to_search[] = 'orderdetails.supplierpartnr'; |
94 | 94 | } |
95 | - if($this->mpn) { |
|
95 | + if ($this->mpn) { |
|
96 | 96 | $fields_to_search[] = 'part.manufacturer_product_url'; |
97 | 97 | } |
98 | - if($this->supplier) { |
|
98 | + if ($this->supplier) { |
|
99 | 99 | $fields_to_search[] = 'suppliers.name'; |
100 | 100 | } |
101 | - if($this->manufacturer) { |
|
101 | + if ($this->manufacturer) { |
|
102 | 102 | $fields_to_search[] = 'manufacturer.name'; |
103 | 103 | } |
104 | - if($this->footprint) { |
|
104 | + if ($this->footprint) { |
|
105 | 105 | $fields_to_search[] = 'footprint.name'; |
106 | 106 | } |
107 | 107 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | //Convert the fields to search to a list of expressions |
121 | - $expressions = array_map(function (string $field) { |
|
121 | + $expressions = array_map(function(string $field) { |
|
122 | 122 | if ($this->regex) { |
123 | 123 | return sprintf("REGEXP(%s, :search_query) = 1", $field); |
124 | 124 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | if ($this->regex) { |
136 | 136 | $queryBuilder->setParameter('search_query', $this->keyword); |
137 | 137 | } else { |
138 | - $queryBuilder->setParameter('search_query', '%' . $this->keyword . '%'); |
|
138 | + $queryBuilder->setParameter('search_query', '%'.$this->keyword.'%'); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 |
@@ -42,15 +42,15 @@ |
||
42 | 42 | |
43 | 43 | $value = $property->getValue($this); |
44 | 44 | //We only want filters (objects implementing FilterInterface) |
45 | - if($value instanceof FilterInterface) { |
|
45 | + if ($value instanceof FilterInterface) { |
|
46 | 46 | $filters[$property->getName()] = $value; |
47 | 47 | } |
48 | 48 | |
49 | 49 | //Add filters in collections |
50 | 50 | if ($value instanceof Collection) { |
51 | 51 | foreach ($value as $key => $filter) { |
52 | - if($filter instanceof FilterInterface) { |
|
53 | - $filters[$property->getName() . '.' . (string) $key] = $filter; |
|
52 | + if ($filter instanceof FilterInterface) { |
|
53 | + $filters[$property->getName().'.'.(string) $key] = $filter; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | $this->cache->invalidateTags([$secure_class_name]); |
58 | 58 | |
59 | 59 | //Trigger a sidebar reload for all users (see SidebarTreeUpdater service) |
60 | - if(!$element instanceof LabelProfile) { |
|
60 | + if (!$element instanceof LabelProfile) { |
|
61 | 61 | $this->cache->invalidateTags(['sidebar_tree_update']); |
62 | 62 | } |
63 | 63 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | { |
27 | 27 | |
28 | 28 | |
29 | - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) { |
|
29 | + $builder->addEventListener(FormEvents::PRE_SET_DATA, function(PreSetDataEvent $event) { |
|
30 | 30 | $form = $event->getForm(); |
31 | 31 | /** @var ProjectBOMEntry $data */ |
32 | 32 | $data = $event->getData(); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function buildForm(FormBuilderInterface $builder, array $options) |
37 | 37 | { |
38 | 38 | //At initialization we have to fill the form element with our selected data, so the user can see it |
39 | - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) { |
|
39 | + $builder->addEventListener(FormEvents::PRE_SET_DATA, function(PreSetDataEvent $event) { |
|
40 | 40 | $form = $event->getForm(); |
41 | 41 | $config = $form->getConfig()->getOptions(); |
42 | 42 | $data = $event->getData() ?? []; |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | |
96 | 96 | $resolver->setDefaults([ |
97 | 97 | //Prefill the selected choice with the needed data, so the user can see it without an additional Ajax request |
98 | - 'choice_attr' => ChoiceList::attr($this, function (?Part $part) { |
|
99 | - if($part) { |
|
98 | + 'choice_attr' => ChoiceList::attr($this, function(?Part $part) { |
|
99 | + if ($part) { |
|
100 | 100 | //Determine the picture to show: |
101 | 101 | $preview_attachment = $this->previewGenerator->getTablePreviewAttachment($part); |
102 | 102 | if ($preview_attachment !== null) { |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $resolver->setDefaults([ |
48 | 48 | 'show_legend' => true, |
49 | 49 | 'show_presets' => false, |
50 | - 'constraints' => static function (Options $options) { |
|
50 | + 'constraints' => static function(Options $options) { |
|
51 | 51 | if (!$options['disabled']) { |
52 | 52 | return [new NoLockout()]; |
53 | 53 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | class ParameterValueConstraintType extends NumberConstraintType |
24 | 24 | { |
25 | - protected const CHOICES = [ |
|
25 | + protected const CHOICES = [ |
|
26 | 26 | '' => '', |
27 | 27 | 'filter.parameter_value_constraint.operator.=' => '=', |
28 | 28 | 'filter.parameter_value_constraint.operator.!=' => '!=', |