Skip to content

Add regex pattern based url generation requirements.#18

Draft
michitheonlyone wants to merge 6 commits intoaraise-dev:mainfrom
michitheonlyone:main
Draft

Add regex pattern based url generation requirements.#18
michitheonlyone wants to merge 6 commits intoaraise-dev:mainfrom
michitheonlyone:main

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

/.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

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.

2 participants