Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠

Adam Sapraliev adamsafr

🏠
View GitHub Profile
@adamsafr
adamsafr / CountryRepository.php
Last active Feb 12, 2021
Doctrine: Union with JOIN example
View CountryRepository.php
<?php
namespace AppBundle\Repository;
use AppBundle\Entity\Country;
use AppBundle\Entity\CountryTranslation;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\ORM\QueryBuilder;
@adamsafr
adamsafr / AbstractBySlugAndActiveSearcher.php
Last active Feb 19, 2021
Symfony: ParamConverter usage example
View AbstractBySlugAndActiveSearcher.php
<?php
namespace FrontEndBundle\Request\ParamConverter;
use Doctrine\Bundle\DoctrineBundle\Registry;
use Doctrine\Common\Persistence\ObjectRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
abstract class AbstractBySlugAndActiveSearcher
@adamsafr
adamsafr / EntityHiddenType.php
Created Sep 7, 2017 — forked from xanaxilovsky/EntityHiddenType.php
[php] Hidden field for Symfony2 entities
View EntityHiddenType.php
<?php
namespace Dpn\ToolsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Doctrine\Common\Persistence\ObjectManager;
use Dpn\ToolsBundle\Form\DataTransformer\EntityToIdTransformer;
View [MySQL] Generate date sequence
SELECT DATE_ADD('2016-08-02', INTERVAL help_topic_id DAY) as mydate
FROM mysql.help_topic order by help_topic_id asc limit 14