Skip to content

Instantly share code, notes, and snippets.

@miedzwin
miedzwin / Container.php
Last active November 12, 2018 16:51
Framework
<?php
namespace Framework\App;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
class Container extends ContainerBuilder
{
/**
<?php
/**
* Load environment variables from file and init them
*
* @throws \Exception
*/
private function initEnvironmentVars()
{
$containerBuilder = new ContainerBuilder();
$fileLocator = new FileLocator(__DIR__ . '/../../');
<?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@miedzwin
miedzwin / Carrier.php
Last active June 6, 2017 17:54
Filters
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* Carrier
*
<?php
namespace Front\Service;
use Api\Service\AuthService;
use Hybrid_User_Profile;
use Entity\User;
class HybridAuthService extends AuthService {
public function getEvaluationsAction(Request $request, $teachingGroupLessonMaterialId)
{
$em = $this->getDoctrine()->getManager();
$user = $this->getUser();
$studentTeachingGroupLessonMaterialRepo = $em->getRepository(StudentTeachingGroupLessonMaterial::class);
$studentTeachingGroupLessonMaterialsOld = $studentTeachingGroupLessonMaterialRepo->getStudentsByTeachingGroupLessonMaterialIdAndTeacherId($teachingGroupLessonMaterialId, $user->getId());
if (is_null($studentTeachingGroupLessonMaterialsOld)) {
throw $this->createNotFoundException();
}
<?php
namespace AppBundle\DoctrineExtensions\Postgres;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
/**
*
*/