Skip to content
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

[Hydra] add collection flag in documentation properties #1189

Merged
merged 1 commit into from
Jun 29, 2017

Conversation

fmata
Copy link
Contributor

@fmata fmata commented Jun 20, 2017

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #912
License MIT
Doc PR n/a

Today it's impossible to know if an Hydra property is a collection of * or not.
I implemented the solution provided on https://lists.w3.org/Archives/Public/public-hydra/2017Jun/0010.html.

  • Add tests
  • Update tests

@fmata fmata force-pushed the hydra_property_collection branch from e8bea53 to f2fcd17 Compare June 23, 2017 15:16
@fmata
Copy link
Contributor Author

fmata commented Jun 23, 2017

@dunglas, can you look quickly before I update the test suite ?


$type = $propertyMetadata->getType();

if (null !== $type && !$type->isCollection() && (null !== $className = $type->getClassName()) && $this->resourceClassResolver->isResourceClass($className)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this part really necessary (null !== $className = $type->getClassName()) && $this->resourceClassResolver->isResourceClass($className)?
Even if it is not a resource, the max cardinality is 1 if it's not a collection isn't it?

@dunglas
Copy link
Member

dunglas commented Jun 23, 2017

Looks good to me @fmata. Great job!

@dunglas
Copy link
Member

dunglas commented Jun 29, 2017

@fmata do you think you can finish this one soon? I would like to include it in 2.1 beta 2 (it is important for our client-side tools).

@fmata fmata force-pushed the hydra_property_collection branch from f2fcd17 to f74b79d Compare June 29, 2017 13:20
@fmata
Copy link
Contributor Author

fmata commented Jun 29, 2017

@dunglas yep but I encounter some problem with the test suite on my setup, many errors or fails unrelated

Unable to parse file "/home/path/api-platform-core/src/Bridge/Symfony/Bundle/DependencyInjection/../Resources/config/filter.xml"

Method Double\Symfony\Component\DependencyInjection\ContainerBuilder\P561::registerForAutoconfiguration() is not defined

...

Method Double\Symfony\Component\DependencyInjection\ContainerBuilder\P566::registerForAutoconfiguration() is not defined

Undefined class constant 'PARSE_KEYS_AS_STRINGS'

I use phpunit in vendors or the bridge.

Tests on Travis fail because order in array keys are not respected :/
Your help is welcome :)

Edit: strange, tests are green now but I changed nothing...

@dunglas
Copy link
Member

dunglas commented Jun 29, 2017

@fmata try to run composer update before running the test suite.

@dunglas dunglas merged commit 4d092e3 into api-platform:master Jun 29, 2017
@dunglas
Copy link
Member

dunglas commented Jun 29, 2017

Thank you very much @fmata!

hoangnd25 pushed a commit to hoangnd25/core that referenced this pull request Feb 23, 2018
…tion

[Hydra] add collection flag in documentation properties
@fmata fmata deleted the hydra_property_collection branch April 25, 2024 23:41
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.

3 participants