Skip to content

fix: add missing import to identifiers #1946

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

Merged
merged 1 commit into from
May 6, 2024
Merged

fix: add missing import to identifiers #1946

merged 1 commit into from
May 6, 2024

Conversation

mboultoureau
Copy link
Contributor

@mboultoureau mboultoureau commented May 6, 2024

Add missing import in identifiers.md.

<?php
// api/src/State/PersonProvider.php

namespace App\State;

use App\Entity\Person;
+ use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface;
use App\Uuid;

/**
 * @implements ProviderInterface<Person>
 */
final class PersonProvider implements ProviderInterface
{
    public function provide(Operation $operation, array $uriVariables = [], array $context = []): Person
    {
        // Our identifier is:
        // $uriVariables['code']
        // although it's a string, it's not an instance of Uuid and we wanted to retrieve the timestamp of our time-based uuid:
        // $uriVariable['code']->getTimestamp()
    }
}

@mboultoureau mboultoureau changed the title Update identifiers.md Fix: add missing import to identifiers.md May 6, 2024
@mboultoureau mboultoureau changed the title Fix: add missing import to identifiers.md fix: add missing import to identifiers.md May 6, 2024
@mboultoureau mboultoureau changed the title fix: add missing import to identifiers.md fix: add missing import to identifiers May 6, 2024
@soyuka soyuka merged commit 15526a4 into api-platform:3.3 May 6, 2024
@mboultoureau mboultoureau deleted the patch-1 branch May 6, 2024 08:30
soyuka pushed a commit that referenced this pull request Sep 18, 2024
soyuka pushed a commit that referenced this pull request Sep 18, 2024
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