This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace App\Validator\Constraints; | |
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; | |
/** | |
* Checks if entity associatied to DTO is unique. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$array = [1, 2, 3, 4, [], [5, 6], 7, 8, [9], [10, [11, 12], 13, [14, 15, 16, [17, [18, [19, 20, 21]]]]], 22, 23, 24, [25], 26, [27, [28], [29, [30, 31], [32], [33, [34, [35, 36], 37, 38, [39, 40]]]]]]; | |
function laravel_flatten($array, $depth = INF) | |
{ | |
return array_reduce($array, function ($result, $item) use ($depth) { | |
if (! is_array($item)) { | |
return array_merge($result, [$item]); | |
} elseif ($depth === 1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
catalog.kernel.request_event_listener: | |
class: App\CoreBundle\EventListener\KernelBootDatabaseSwitchListener | |
arguments: [@request, @doctrine.dbal.default_connection, @logger] | |
scope: request | |
tags: | |
- { name: kernel.event_listener, event: kernel.request, method: onKernelRequest } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Doctrine; | |
use AppBundle\Entity\Organisation; | |
use Doctrine\DBAL\Connection; | |
use Acme\Common\DatabaseNameResolver; | |
class DataConnectionWrapper extends Connection | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class Enum { | |
private $name; | |
private static $enums; | |
private function __construct($name) { | |
$this->name = $name; | |
} | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace App\ORM\Hydration; | |
use Doctrine\ORM\Internal\Hydration\ArrayHydrator; | |
/** | |
* Returns one-dimensional scalar array from query: mixed[][] => mixed[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SymfonyFormTransformer { | |
/** | |
* @param FormInterface $form | |
* @return string | |
*/ | |
public function transformFormToText(FormInterface $form) | |
{ | |
$txt = ''; | |
foreach ($form->getData() as $inputName => $inputValue) { |
NewerOlder