Skip to content

Instantly share code, notes, and snippets.

Avatar

Yan Ivanov franzose

View GitHub Profile
View doctrine.yaml
parameters:
# Adds a fallback DATABASE_URL if the env var is not set.
# This allows you to run cache:warmup even if your
# environment variables are not available yet.
# You should not need to change this value.
env(DATABASE_URL): ''
doctrine:
dbal:
# configure these for your database server
@fesor
fesor / README.md
Last active Oct 1, 2021
What is OOP
View README.md

Что такое ООП

Ссылки на материалы, позволяющее лучше понять оригинальную идею.

Quotes

Java and C++ make you think that the new ideas are like the old ones. Java is the most distressing thing to hit computing since MS-DOS.

Alan Kay

@vudaltsov
vudaltsov / Condition.php
Last active Sep 22, 2021
Conditional validator
View Condition.php
<?php
declare(strict_types=1);
namespace App\Validator\Constraints;
use Symfony\Component\Validator\Constraints\Composite;
/**
* @Annotation()
View AspectOperators.kt
// Aspect interface for combinator
interface Aspect {
operator fun <R> invoke(block: () -> R): R
}
// Aspect combinator
operator fun Aspect.plus(other: Aspect) = object : Aspect {
override fun <R> invoke(block: () -> R): R =
this@plus {
other {
@enleur
enleur / ConstraintViolationsConverter.php
Last active May 18, 2022
Symfony json body to request object auto mapping
View ConstraintViolationsConverter.php
<?php
namespace App\Request\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\ConstraintViolationListInterface;
final class ConstraintViolationsConverter implements ParamConverterInterface
@fesor
fesor / README.md
Created Jul 25, 2018
Symfony without ORM
View README.md

Удобный менеджмент миграций с Symfony и Doctrine

Мало кто знает, но что бы работал migration:diff вам не нужно ставить ORM.

Что бы это работало объявим простой сервис:

<?php
@saqueib
saqueib / errorHandler.js
Last active May 9, 2022
Global error handling using axios interceptor for http calls http://www.qcode.in/api-error-handling-in-vue-with-axios
View errorHandler.js
import axios from 'axios'
import toast from './toast'
function errorResponseHandler(error) {
// check for errorHandle config
if( error.config.hasOwnProperty('errorHandle') && error.config.errorHandle === false ) {
return Promise.reject(error);
}
// if has response show the error
View SymfonyLoopedCommand.php
<?php
declare(strict_types=1);
namespace App\Command;
use App\Symfony\EventDispatcher;
use Doctrine\DBAL\Driver\Connection;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\ConsoleEvents;
@gskema
gskema / BulkInsertQuery.php
Last active Apr 18, 2022
PHP PDO / Doctrine DBAL bulk insert query
View BulkInsertQuery.php
<?php
namespace YourApp\Repository\Query;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Identifier;
/**
* Class BulkInsertQuery
*
@boekkooi
boekkooi / CustomPropertyAccessor.php
Last active Dec 23, 2020
Using a custom property path for symfony forms set / get path
View CustomPropertyAccessor.php
<?php
use Symfony\Component\PropertyAccess\PropertyAccessor;
use Symfony\Component\PropertyAccess\PropertyPath;
/**
* A property accessor that allows you to rewrite a property path for setters and getters.
*/
class CustomPropertyAccessor extends PropertyAccessor
{
/**