Skip to content

Instantly share code, notes, and snippets.

<?php
namespace App\Validator;
use Symfony\Component\Validator\Constraints\Range;
use Symfony\Component\Validator\Constraints\RangeValidator;
class YearRange extends Range
{
public function __construct($options)
<?php
namespace App\Form\Type;
use Money\Currencies\ISOCurrencies;
use Money\Currency;
use Money\Formatter\DecimalMoneyFormatter;
use Money\Parser\DecimalMoneyParser;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Validator\Validation;
class TestedTypeTest extends TypeTestCase
{
private $validator;
protected function getExtensions()
{
$validator = Validation::createValidator();
private function addHttpClientOptionsSection(NodeBuilder $rootNode): NodeBuilder
{
return $rootNode
->integerNode('max_host_connections')
->info('The maximum number of connections to a single host.')
->defaultValue(6)
->end()
->arrayNode('default_options')
->children()
->fixXmlConfig('header')
private function addHttpClientSection(ArrayNodeDefinition $rootNode)
{
$subNode = $rootNode
->children()
->arrayNode('http_client')
->info('HTTP Client configuration')
->canBeEnabled()
->fixXmlConfig('client')
->children();
manyToOne:
candidate:
targetEntity: \AppBundle\Entity\Candidate
inversedBy: interviews
joinColumn:
name: candidate_id
referencedColumnName: id
user:
targetEntity: \AppBundle\Entity\User
inversedBy: interviews
{
"require": {
"symfony/symfony": "^4.0"
},
"minimum-stability": "dev"
}
<?php
declare(strict_types = 1);
namespace App\Entity;
class Product
{
public $id;
json.form.normalizer:
class: Adsc\MyBundle\Normalizer\FormErrorNormalizer
tags:
- { name: serializer.normalizer, priority: 10 }
public function findByProductId($id) {
return $this->createQueryBuilder('mc')
->join('mc.product', 'product')
->where('product.id = :id')
->setParameter('id', $id)
;
}