api-platform.com

“Argument 1 passed to ApiPlatform\Core\Bridge\Doctrine\Orm\Metadata\Property\DoctrineOrmPropertyMetadataFactory::__construct() must be an instance…”

我怕爱的太早我们不能终老 提交于 2021-01-20 08:53:45
问题 While attempting to install Api-Platform (or run composer update on an existing Api-Platform installation, I get an error like this: Uncaught Error: Argument 1 passed to ApiPlatform\Core\Bridge\Doctrine\Orm\Metadata\Property\DoctrineOrmPropertyMetadataFactory::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry, instance of Doctrine\Bundle\DoctrineBundle\Registry given, called in App_KernelDevDebugContainer.php on line 1530 ["exception" => TypeError { …}] What can

Nginx alias breaks due to try_files $uri alias bug

為{幸葍}努か 提交于 2021-01-07 05:10:20
问题 I have a versioned Symfony API instance that I want to configure in the following manner: api.com/api/v1 -> /srv/api-v1/public/index.php api.com/api/v2 -> /srv/api-v2/public/index.php I've tried to approach this using nginx location and aliases, as it's Symfony we use try_files (as recommended) to check for an actual file prior to defaulting to index.php . Problem It seems there is a known nginx bug that breaks the $uri variable with an alias and try_files . How can I get around this bug to

Nginx alias breaks due to try_files $uri alias bug

谁说胖子不能爱 提交于 2021-01-07 05:04:43
问题 I have a versioned Symfony API instance that I want to configure in the following manner: api.com/api/v1 -> /srv/api-v1/public/index.php api.com/api/v2 -> /srv/api-v2/public/index.php I've tried to approach this using nginx location and aliases, as it's Symfony we use try_files (as recommended) to check for an actual file prior to defaulting to index.php . Problem It seems there is a known nginx bug that breaks the $uri variable with an alias and try_files . How can I get around this bug to

How to always filter a collection on specific field value in api-platform GET operations?

半城伤御伤魂 提交于 2020-12-31 06:24:44
问题 In the GET operations, I'd like to exclude from the returning collections my entities that have an " archive" field that equals " true ". I'd like that to be the default for my endpoints like /users or /companies and i want to avoid to add an URL filter by hand like /users?filter[archive]=true what would be the best way to do that ? Thanks for any help :) 回答1: I had to do something like that, and I solved it by applying a DoctrineExtension to a Collection that will add the WHERE clause to the

How to always filter a collection on specific field value in api-platform GET operations?

拈花ヽ惹草 提交于 2020-12-31 06:24:17
问题 In the GET operations, I'd like to exclude from the returning collections my entities that have an " archive" field that equals " true ". I'd like that to be the default for my endpoints like /users or /companies and i want to avoid to add an URL filter by hand like /users?filter[archive]=true what would be the best way to do that ? Thanks for any help :) 回答1: I had to do something like that, and I solved it by applying a DoctrineExtension to a Collection that will add the WHERE clause to the

Operation without entity

孤者浪人 提交于 2020-12-15 01:41:07
问题 I've been looking for a solution for a while but none of the one I find really allows me to do what I want. I would just like to create routes that don't necessarily require an entity or id to be used. Can you help me the documentation is not clear to do this. Thank you beforehand. 回答1: Thanks you for answer. I had some information but not everything. I will try the weekend. 回答2: As you can read in the General Design Considerations, just make an ordinary PHP class (POPO). Give it an

Symfony NotBlank constraint allow blank string

安稳与你 提交于 2020-12-13 03:22:26
问题 I'm working with Symfony5 and ApiPlatform with phpunit for the tests I'm running tests on field validation. My issue comes from the fact that I want to restrain the user's possiblity to enter a blank string in a property named name as follow : /** * @ApiResource( * attributes={ * "normalization_context"={"groups"={"cons:read", "cons:list"}}, * "denormalization_context"={"groups"={"cons:write"}} * }, * collectionOperations={ * "get"={ * "mehtod"="GET", * "normalization_context"={"groups"={

Symfony NotBlank constraint allow blank string

冷暖自知 提交于 2020-12-13 03:22:10
问题 I'm working with Symfony5 and ApiPlatform with phpunit for the tests I'm running tests on field validation. My issue comes from the fact that I want to restrain the user's possiblity to enter a blank string in a property named name as follow : /** * @ApiResource( * attributes={ * "normalization_context"={"groups"={"cons:read", "cons:list"}}, * "denormalization_context"={"groups"={"cons:write"}} * }, * collectionOperations={ * "get"={ * "mehtod"="GET", * "normalization_context"={"groups"={

Symfony NotBlank constraint allow blank string

荒凉一梦 提交于 2020-12-13 03:20:29
问题 I'm working with Symfony5 and ApiPlatform with phpunit for the tests I'm running tests on field validation. My issue comes from the fact that I want to restrain the user's possiblity to enter a blank string in a property named name as follow : /** * @ApiResource( * attributes={ * "normalization_context"={"groups"={"cons:read", "cons:list"}}, * "denormalization_context"={"groups"={"cons:write"}} * }, * collectionOperations={ * "get"={ * "mehtod"="GET", * "normalization_context"={"groups"={