Skip to content

Instantly share code, notes, and snippets.

View ismail1432's full-sized avatar
🏠
Looking for remote job

Smaine Milianni ismail1432

🏠
Looking for remote job
View GitHub Profile
// Kernel.php
<?php
namespace App;

use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
// Kernel.php
<?php
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Mime\FileBinaryMimeTypeGuesser;
<?php
use Symfony\Component\Mime\{MimeTypes, FileBinaryMimeTypeGuesser};
class FileCreator
{
public function create(string $filePath): void
{
$mimeTypes = new MimeTypes();
// The last registered guesser has precedence over the other ones.
<?php
use Symfony\Component\Mime\MimeTypes;
class FileCreator
{
public function create(string $filePath): void
{
$mimeTypes = new MimeTypes();
$mimeType = $mimeTypes->guessMimeType($filePath);
<?php
declare(strict_types=1);
namespace Infrastructure\Symfony\Mime;
use Symfony\Component\Mime\FileBinaryMimeTypeGuesser;
use Symfony\Component\Mime\MimeTypeGuesserInterface;
/**

Remove a column

We want to remove the column name from table user

current version, V 1.0

class User
{
  /**
   * @ORM\Column(type="string", nullable=false)
 */
class EmojiType extends AbstractType
{
  
    public function configureOptions(OptionsResolver $resolver)
    {

                        $countriesCode = Countries::getNames($options['choice_translation_locale']);
+                        // If the option "only_emoji" is true, we display just the emoji
+                        if (true === $options['only_emoji']) {
<?php
// The form
namespace App\Form;
use App\Entity\Address;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\ChoiceList\ChoiceList;
use Symfony\Component\Form\Extension\Core\Type\CountryType;
use Symfony\Component\Intl\Countries;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
<?php
class EmojiType extends AbstractType
{
public function getParent()
{
return CountryType::class;
}
public static function getEmojiFlag(string $countryCode): string