Skip to content

Mercure Publish fails if expression returns bool false #3681

@dennobaby

Description

@dennobaby

API Platform version(s) affected: 2.5

Description
Mercure Publish fails if an expression is used which could return false:
The value of the "mercure" attribute of the "MyClass" resource class must be a boolean, an array of options or an expression returning this array, "boolean" given.'

How to reproduce

/**
  * @ApiResource(
  *    mercure="object.mercure()"
  * )
  */
class MyClass
{
[...]
    private function mercure(){
        return false;
    }
}

Possible Solution
Maybe just move the if-clause in

after the expression-evaluation in

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