Skip to content

Instantly share code, notes, and snippets.

View adamsafr's full-sized avatar
🏠

Adam Sapraliev adamsafr

🏠
View GitHub Profile
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
@adamsafr
adamsafr / EntityHiddenType.php
Created September 7, 2017 08:49
[php] Hidden field for Symfony2 entities
<?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;
@adamsafr
adamsafr / AbstractBySlugAndActiveSearcher.php
Last active March 31, 2023 09:03
Symfony: ParamConverter usage example
<?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 / CountryRepository.php
Last active September 5, 2023 09:17
Doctrine: Union with JOIN example
<?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;