Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regex pattern based url generation requirements. #18

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

michitheonlyone
Copy link

Added support for UUID's if the entity has a uuid as a key.

Added regex pattern to generate uuid url for entity's with UUID keys.
@todo add patterns to support other versions e.g. ulid as well.
Added regex pattern to generate uuid url for entity's with UUID keys.
@todo add patterns to support other versions e.g. ulid as well.
Copy link
Contributor

@tuxes3 tuxes3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried this MR but with a simple setup like following:

    #[ORM\Id]
    #[ORM\Column(type: UuidType::NAME, unique: true)]
    #[ORM\GeneratedValue(strategy: 'CUSTOM')]
    #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
    private ?Uuid $id = null;

it did not work. To make this fully work it will need some minor changes in the CrudController. See `$request->query->getInt and second occurrence

@@ -5,3 +5,5 @@
/.phpunit.result.cache
/phpunit.xml
/yarn.lock
/.idea
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not add IDE specific files to the gitignore

@@ -12,6 +12,9 @@

class CrudLoader extends Loader
{
// TODO: add patterns to support other versions e.g. ulid as well.
private const URL_GENERATOR_ENTITY_KEY_REQUIREMENT_EXPRESSION = '[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|\d+';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to support wide range of id we should allow to configure this regex in the bundles config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants