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 | |
private function findSelectWithRelation(): array | |
{ | |
$queryBuilder = $this->createQueryBuilder('invoice') | |
->select(' | |
invoice.id AS invoiceId, | |
SUBSTRING_INDEX( | |
GROUP_CONCAT(history.id ORDER BY history.date DESC SEPARATOR \'#\'), |
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\Shared\Infrastructure\Validator\Constraints; | |
use Symfony\Component\Validator\Attribute\HasNamedArguments; | |
use Symfony\Component\Validator\Constraint; | |
use Symfony\Component\Validator\Exception\ConstraintDefinitionException; |
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\Form\Extension; | |
use Symfony\Component\Form\AbstractTypeExtension; | |
use Symfony\Component\Form\ChoiceList\ChoiceList; | |
use Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader; | |
use Symfony\Component\Form\Exception\LogicException; |
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 | |
public function findByRole(Role $role): mixed | |
{ | |
$rsm = $this->createResultSetMappingBuilder('u'); | |
$query = <<<SQL | |
SELECT %s | |
FROM user u | |
WHERE u.roles::jsonb ?? :role |
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
WITH estimate_inter_durations AS ( | |
SELECT (json_array_elements(estimate_inter.sequences)->>'duration')::float AS duration, estimate_inter.id | |
FROM estimate_inter | |
INNER JOIN estimate ON estimate.id = estimate_inter.id | |
WHERE estimate.id = estimate_inter.id | |
) | |
UPDATE estimate | |
SET duration_value = ( | |
SELECT SUM(duration) |
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\Form\Field; | |
use App\Form\Util\StringUtil; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\FormInterface; | |
use Symfony\Component\Form\FormView; |
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\Form; | |
use App\Form\Util\StringUtil; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\Extension\Core\Type\CollectionType; | |
use Symfony\Component\Form\FormInterface; |
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 | |
$rules = [ | |
'@PHP74Migration' => true, | |
'@PHP74Migration:risky' => true, | |
'@PhpCsFixer' => true, | |
'@PhpCsFixer:risky' => true, | |
'binary_operator_spaces' => [ | |
'default' => 'single_space', | |
'operators' => ['=>' => null] |
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 Aperitips; | |
/** | |
* Class Collection. | |
* | |
* Example of using Iterator, Countable, ArrayAccess, JsonSerializable and Serializable interfaces | |
* | |
* @author Romain Monteil <[email protected]> |
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
CREATE DEFINER=`root`@`localhost` | |
PROCEDURE `getMediaNear`(IN `latitude` DOUBLE, IN `longitude` DOUBLE, IN `distance` FLOAT) | |
NO SQL | |
BEGIN | |
DECLARE `lon1` FLOAT; | |
DECLARE `lon2` FLOAT; | |
DECLARE `lat1` FLOAT; | |
DECLARE `lat2` FLOAT; | |
SET lon1 = longitude-distance/abs(cos(radians(latitude))*111); |