Skip to content

Commit

Permalink
minor #3376 Use Symfony UID to generate ULIDs (javiereguiluz)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.0.x-dev branch.

Discussion
----------

Use Symfony UID to generate ULIDs

Commits
-------

bc3be3b Use Symfony UID to generate ULIDs
  • Loading branch information
javiereguiluz committed Jun 23, 2020
2 parents 9781c31 + bc3be3b commit d2482c8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 104 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"symfony/security-bundle": "^4.4|^5.0",
"symfony/string": "^5.0",
"symfony/translation": "^4.4|^5.0",
"symfony/twig-bundle": "^4.4|^5.0"
"symfony/twig-bundle": "^4.4|^5.0",
"symfony/uid": "^5.1"
},
"require-dev": {
"psr/log": "~1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/Dto/FieldDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
use EasyCorp\Bundle\EasyAdminBundle\Provider\UlidProvider;
use Symfony\Component\Uid\Ulid;
use function Symfony\Component\String\u;

/**
Expand Down Expand Up @@ -68,7 +68,7 @@ public function getUniqueId(): string
return $this->uniqueId;
}

return $this->uniqueId = UlidProvider::new();
return $this->uniqueId = new Ulid();
}

public function isFormDecorationField(): bool
Expand Down
4 changes: 2 additions & 2 deletions src/Field/FormField.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
use EasyCorp\Bundle\EasyAdminBundle\Form\Type\EaFormPanelType;
use EasyCorp\Bundle\EasyAdminBundle\Provider\UlidProvider;
use Symfony\Component\Uid\Ulid;

/**
* @author Javier Eguiluz <javier.eguiluz@gmail.com>
Expand All @@ -30,7 +30,7 @@ public static function addPanel(?string $label = null, ?string $icon = null)
return $field
->setFieldFqcn(__CLASS__)
->hideOnIndex()
->setProperty('ea_form_panel_'.(UlidProvider::new()))
->setProperty('ea_form_panel_'.(new Ulid()))
->setLabel($label)
->setTemplateName('crud/field/form_panel')
->setFormType(EaFormPanelType::class)
Expand Down
99 changes: 0 additions & 99 deletions src/Provider/UlidProvider.php

This file was deleted.

0 comments on commit d2482c8

Please sign in to comment.