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
@ismail1432
ismail1432 / php72questions.yaml
Last active June 7, 2018 14:52
PHP 7.2 questions
- question : "In which PHP version can I typehint a Object using the 'object' keyword ?"
answers :
- OK 7.2
- KO 7.0
- KO 7.1
- none of above
- KO 5.6
component : PHP
extra_link : http://php.net/manual/en/migration72.new-features.php
@ismail1432
ismail1432 / User.php
Created September 14, 2018 14:36 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
st = status
co = checkout
cob = checkout --no-track -b
cp = cherry-pick
rb = rebase
rbom = rebase origin/master
rbi = rebase -i
rbiom = rebase -i origin/master
c = commit
ca = commit --amend
@ismail1432
ismail1432 / UploadImage.php
Created January 16, 2019 22:30
"Serialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed"
<?php
// src/Form/EditUserType.php
class EditUserType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('email', EmailType::class)
->add('password', RepeatedType::class, [
'type' => PasswordType::class,
<?php
final class FilterEagerLoadingExtension
{
// ...
private function getQueryBuilderWithNewAliases(QueryBuilder $queryBuilder,QueryNameGeneratorInterface $queryNameGenerator,string $originAlias = 'o', string $replacement = 'o_2')
{
// ...
// Change join aliases
foreach ($joinParts[$originAlias] as $joinPart) {
/** @var Join $joinPart */
<?php
class CollectionDataProvider implements ContextAwareCollectionDataProviderInterface, RestrictedDataProviderInterface
{
private $managerRegistry;
private $collectionExtensions;
private $requestStack;
private $serializer;
/**
<?php
namespace App\Validator;
use Symfony\Component\Validator\Constraint;
/**
* @Annotation
*/
class Role extends Constraint
<?php
namespace App\Validator;
use Symfony\Component\Validator\Constraint;
/**
* @Annotation
*/
class Role extends Constraint
<?php
namespace App\Validator;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
class RoleValidator extends ConstraintValidator
{
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Validator as CustomValidator;
/**
* @ORM\Entity(repositoryClass="App\Repository\PostRepository")
* @ApiResource(