Skip to content

"BlogPost" hardcoded in templates for Normalizer and Voter #395

@stefan2

Description

@stefan2

Shouldn't "BlogPost" be replaced by an entity name?

Normalizer

https://github.com/symfony/maker-bundle/blob/master/src/Resources/skeleton/serializer/Normalizer.tpl.php#L28

public function supportsNormalization($data, $format = null): bool 
{
    return $data instanceof \App\Entity\BlogPost;
}

Voter

https://github.com/symfony/maker-bundle/blob/master/src/Resources/skeleton/security/Voter.tpl.php#L16

protected function supports($attribute, $subject)
{
    // replace with your own logic
    // https://symfony.com/doc/current/security/voters.html
    return in_array($attribute, ['POST_EDIT', 'POST_VIEW'])
        && $subject instanceof \App\Entity\BlogPost;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions