mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-21 11:24:40 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
eef26f7ae6
commit
639829f5c5
97 changed files with 305 additions and 185 deletions
|
@ -25,6 +25,8 @@ namespace App\Form;
|
|||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
use Symfony\Component\Form\AbstractTypeExtension;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||
use Symfony\Component\Form\FormBuilder;
|
||||
|
@ -104,12 +106,12 @@ class CollectionTypeExtension extends AbstractTypeExtension
|
|||
* Set the option of the form.
|
||||
* This a bit hacky cause we access private properties....
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function setOption(FormBuilder $builder, string $option, $value): void
|
||||
{
|
||||
//We have to use FormConfigBuilder::class here, because options is private and not available in sub classes
|
||||
$reflection = new \ReflectionClass(FormConfigBuilder::class);
|
||||
$reflection = new ReflectionClass(FormConfigBuilder::class);
|
||||
$property = $reflection->getProperty('options');
|
||||
$property->setAccessible(true);
|
||||
$tmp = $property->getValue($builder);
|
||||
|
|
|
@ -47,6 +47,7 @@ use App\Entity\Base\AbstractStructuralDBElement;
|
|||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Services\Trees\NodesListBuilder;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Intl\Currencies;
|
||||
use Symfony\Component\OptionsResolver\Options;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
@ -96,7 +97,7 @@ class CurrencyEntityType extends StructuralEntityType
|
|||
protected function getChoiceContent(AbstractStructuralDBElement $choice, $key, $value, $options): string
|
||||
{
|
||||
if(!$choice instanceof Currency) {
|
||||
throw new \RuntimeException('$choice must be an instance of Currency!');
|
||||
throw new RuntimeException('$choice must be an instance of Currency!');
|
||||
}
|
||||
|
||||
//Generate the level spacing
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace App\Form\Type;
|
|||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Contracts\HasMasterAttachmentInterface;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
|
@ -85,7 +86,7 @@ class MasterPictureAttachmentType extends AbstractType
|
|||
static function () use ($options) {
|
||||
$entity = $options['entity'];
|
||||
if (!$entity instanceof AttachmentContainingDBElement) {
|
||||
throw new \RuntimeException('$entity must have Attachments! (be of type AttachmentContainingDBElement)');
|
||||
throw new RuntimeException('$entity must have Attachments! (be of type AttachmentContainingDBElement)');
|
||||
}
|
||||
|
||||
return $entity->getAttachments()->toArray();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue