Skip to content

Instantly share code, notes, and snippets.

View walva's full-sized avatar
🏠
Working from home

Ellis Benjamin walva

🏠
Working from home
View GitHub Profile
@walva
walva / config.yaml
Created October 14, 2016 17:05
symfony 3 puphpet config : + ubuntu1604 + PHP7.0 + nginx + mysql +
vagrantfile:
target: local
vm:
provider:
local:
box: puphpet/ubuntu1604-x64
box_url: puphpet/ubuntu1604-x64
box_version: 'false'
chosen_virtualizer: virtualbox
virtualizers:
@walva
walva / SnakeCaseGroupsValidationParser.php
Last active February 17, 2020 15:07
Use NelmioAPiDocBundle with JmsSerializerBundle : handling snakecase and groups in the same time
<?php
namespace SulivanDotEu\ApiBundle\Parser;
use Nelmio\ApiDocBundle\DataTypes;
use Nelmio\ApiDocBundle\Parser\ValidationParser;
use Symfony\Component\Validator\Mapping\PropertyMetadata;
class SnakeCaseGroupsValidationParser extends ValidationParser
{
trait StatusTrait
{
public static function ALL_STATUS($associative = false)
{
$oClass = new \ReflectionClass(__CLASS__);
$all = $oClass->getConstants();
$all = array_filter($all,
function ($value) {
return strpos($value, 'STATUS_') === 0;
@walva
walva / MakeRepository.php
Created August 18, 2018 16:21
Create repository from entity
<?php
/**
* Created by PhpStorm.
* User: Benjamin
* Date: 18-08-18
* Time: 17:47
*/
namespace App\Maker;
@walva
walva / EntityHiddenTransformer.php
Created February 26, 2020 15:08
EntityHiddenType
<?php
namespace App\Form\DataTransformer;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
class EntityHiddenTransformer implements DataTransformerInterface
{
@walva
walva / profiles.json
Created March 15, 2020 16:52
Windows Terminal (Preview) with Cmder
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{8b60d43f-c609-4b1d-9a6c-f7f7dac120b6}",
"profiles": {
"defaults": {
// Put settings here that you want to apply to all profiles
},
"list": [
@walva
walva / php
Created June 15, 2021 06:41
DatabaseContext for behat
<?php
namespace App\Tests\Behat;
use Behat\Behat\Context\Context;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Tools\SchemaTool;
use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;