Skip to content

Instantly share code, notes, and snippets.

View vudaltsov's full-sized avatar
🐘

Valentin Udaltsov vudaltsov

🐘
View GitHub Profile
@vudaltsov
vudaltsov / domain_constraints_news_slug.php
Last active December 12, 2018 21:27
Domain constraints for Symfony Validator
<?php
use Symfony\Component\Validator\Constraints as Assert;
final class NewsDto
{
/**
* @Assert\NotNull()
* @Assert\Type("string")
* @Assert\Length(min=5, max=50)
@vudaltsov
vudaltsov / domain_constraints_article_slug.php
Created December 12, 2018 21:26
Domain constraints for Symfony Validator: ArticleDto
<?php
use Symfony\Component\Validator\Constraints as Assert;
final class ArticleDto
{
/**
* @Assert\NotNull()
* @Assert\Type("string")
* @Assert\Length(min=5, max=50)
@vudaltsov
vudaltsov / FixPostgreSQLDefaultSchemaListener.php
Last active March 3, 2024 10:08
Doctrine PostgreSQL Default Schema Fix For Symfony
<?php
declare(strict_types=1);
namespace App\Doctrine\EventListener;
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
final class FixPostgreSQLDefaultSchemaListener
@vudaltsov
vudaltsov / Currency.orm.xml
Last active April 23, 2019 11:31
PHP Money Doctrine XML Mapping
<!-- config/doctrine/money/Currency.orm.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Money\Currency">
<field name="code" length="3"/>
</embeddable>
@vudaltsov
vudaltsov / statistics.md
Last active May 7, 2019 11:10
EU-FOSSA Statistics
Код Документация Diversity API Platform
Новые Issue 143 3 3 4
Закрытые Issue 79 11 3 87
Предложенные PR 181 17 12 10
Смердженные PR 107 35 17 20
@vudaltsov
vudaltsov / Condition.php
Last active September 22, 2021 15:18
Conditional validator
<?php
declare(strict_types=1);
namespace App\Validator\Constraints;
use Symfony\Component\Validator\Constraints\Composite;
/**
* @Annotation()
@vudaltsov
vudaltsov / PostgreSQLUpsertBuilder.php
Created July 14, 2019 21:24
PostgreSQLUpsertBuilder
<?php
declare(strict_types=1);
namespace App\Doctrine\DBAL\Builder;
use Countable;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Statement;
use Webmozart\Assert\Assert;
@vudaltsov
vudaltsov / install.sh
Created July 25, 2019 12:26
phpenv Mac install script
CONFIGURE_OPTS="\
--with-zlib-dir=$(brew --prefix zlib)\
--with-bz2=$(brew --prefix bzip2)\
--with-iconv=$(brew --prefix libiconv)\
--with-readline=$(brew --prefix readline)\
--with-libedit=$(brew --prefix libedit)\
--with-tidy=$(brew --prefix tidy-html5)\
--with-curl=$(brew --prefix curl)\
--with-jpeg-dir=$(brew --prefix jpeg)\
--with-png-dir=$(brew --prefix libpng)\
@vudaltsov
vudaltsov / Makefile
Created September 26, 2019 19:29
Makefile for a Symfony project
DOCKER_COMPOSE = docker-compose
EXEC_PHP = $(DOCKER_COMPOSE) exec -T php
SYMFONY = $(EXEC_PHP) bin/console
COMPOSER = $(EXEC_PHP) composer
##
## Проект
## ------
install: start db ## Установить и запустить проект
@vudaltsov
vudaltsov / Makefile
Created December 10, 2019 14:55
Self-documenting Makefile with categories and aliases
##
## Tools
## -----
ls: list-files
list-files: ## List files
ls -lah
.PHONY: ls list-files