svg
This commit is contained in:
parent
4c08435bd8
commit
9a2e4755e1
@ -44,7 +44,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
private ?string $email = null;
|
||||
|
||||
#[ORM\ManyToMany(targetEntity: Company::class, inversedBy: 'users')]
|
||||
private Collection $companys;
|
||||
private ?Collection $companys;
|
||||
|
||||
#[ORM\ManyToOne()]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
@ -157,7 +157,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
/**
|
||||
* @return Collection<int, Company>
|
||||
*/
|
||||
public function getCompanys(): Collection
|
||||
public function getCompanys(): ?Collection
|
||||
{
|
||||
return $this->companys;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ final class SessionListener
|
||||
$session = $request->getSession();
|
||||
|
||||
$user = $this->security->getUser();
|
||||
if ($user instanceof User && $user) {
|
||||
if ($user instanceof User) {
|
||||
// Intialisation de la compagnie en cours
|
||||
if (!$user->getCompany()) {
|
||||
if ($user->getCompanys()) {
|
||||
|
@ -4,6 +4,7 @@ namespace App\Form;
|
||||
|
||||
use App\Entity\Accounting;
|
||||
use App\Form\DataTransformer\ThreeDigitTransformer;
|
||||
use App\Form\Type\FontawsomeType;
|
||||
use App\Form\Type\ThreeDigitType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
@ -14,13 +15,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class AccountingType extends AbstractType
|
||||
{
|
||||
private ThreeDigitTransformer $threeDigitTransformer;
|
||||
|
||||
public function __construct(ThreeDigitTransformer $threeDigitTransformer)
|
||||
{
|
||||
$this->threeDigitTransformer = $threeDigitTransformer;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
|
@ -11,7 +11,7 @@ class ThreeDigitTransformer implements DataTransformerInterface
|
||||
return null !== $value ? str_pad($value, 3, '0', STR_PAD_LEFT) : null;
|
||||
}
|
||||
|
||||
public function reverseTransform($value): ?int
|
||||
public function reverseTransform($value): string
|
||||
{
|
||||
return str_pad($value, 3, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ class ImageService
|
||||
}
|
||||
|
||||
// Création de l'image redimentionnée
|
||||
$newImageWidth = ceil($width * $scale);
|
||||
$newImageHeight = ceil($height * $scale);
|
||||
$newImageWidth = (int) ceil($width * $scale);
|
||||
$newImageHeight = (int) ceil($height * $scale);
|
||||
$newImage = imagecreatetruecolor($newImageWidth, $newImageHeight);
|
||||
|
||||
switch ($imageType) {
|
||||
@ -54,6 +54,9 @@ class ImageService
|
||||
case 'image/webp':
|
||||
$source = imagecreatefromwebp($image);
|
||||
break;
|
||||
default:
|
||||
$source= imagecreatefromgif($image);
|
||||
break;
|
||||
}
|
||||
|
||||
imagecopyresampled($newImage, $source, 0, 0, 0, 0, $newImageWidth, $newImageHeight, $width, $height);
|
||||
@ -88,8 +91,8 @@ class ImageService
|
||||
}
|
||||
|
||||
// Création de l'image redimentionnée
|
||||
$newImageWidth = ceil($cropWidth * $scale);
|
||||
$newImageHeight = ceil($cropHeight * $scale);
|
||||
$newImageWidth = (int) ceil($cropWidth * $scale);
|
||||
$newImageHeight = (int) ceil($cropHeight * $scale);
|
||||
|
||||
$newImage = imagecreatetruecolor($newImageWidth, $newImageHeight);
|
||||
|
||||
@ -109,6 +112,9 @@ class ImageService
|
||||
case 'image/webp':
|
||||
$source = imagecreatefromwebp($image);
|
||||
break;
|
||||
default:
|
||||
$source= imagecreatefromgif($image);
|
||||
break;
|
||||
}
|
||||
|
||||
imagecopyresampled($newImage, $source, 0, 0, $x, $y, $newImageWidth, $newImageHeight, $cropWidth, $cropHeight);
|
||||
|
Loading…
Reference in New Issue
Block a user