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

Added resource type parameter to Provider::getConnector #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bilge
Copy link
Member

@Bilge Bilge commented Nov 6, 2017

Following up on the TODO comment from #41, this PR doesn't pass the resource to Provider::getConnector, but rather, just the resource's type. I don't feel comfortable passing the entire resource because the only real use-case for passing the resource is to make decisions based on its type.

Passing the entire object might cause people to do questionable things with the resource so we just pass the type name as a string instead. Unfortunately, this makes type checking code a little more cumbersome to write. Instead of $resource instanceof Foo we must write is_a($resourceType, Foo::class, true). Moreover, we lose the ability to distinguish between difference instances of Foo, but it is supposed no valid use cases exist for this.

The use-case for passing the resource type is applications that want to distinguish between different groups of resources that the API itself does not make. That is, certain applications may wish to group certain members of a provider's resources for application-defined reasons and pass different connectors to them.


Must decide whether or not we want this before v4 is released because it's a breaking change otherwise.

@Bilge Bilge added this to the 4.0.0 milestone Nov 6, 2017
@codecov-io
Copy link

codecov-io commented Nov 6, 2017

Codecov Report

Merging #47 into 4.0 will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@         Coverage Diff         @@
##            4.0    #47   +/-   ##
===================================
  Coverage   100%   100%           
===================================
  Files        29     29           
  Lines       371    371           
===================================
  Hits        371    371
Impacted Files Coverage Δ
src/Connector/CachingConnector.php 100% <ø> (ø) ⬆️
src/Provider/StaticDataProvider.php 100% <100%> (ø) ⬆️
src/Porter.php 100% <100%> (ø) ⬆️
src/Collection/RecordCollection.php 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61f6432...4be5207. Read the comment docs.

@Bilge Bilge changed the title Added resource type parameter to Provider::getConnector. Added resource type parameter to Provider::getConnector Nov 6, 2017
@ScriptFUSION ScriptFUSION deleted a comment from sourcelevel-bot bot Nov 6, 2017
@ScriptFUSION ScriptFUSION deleted a comment from sourcelevel-bot bot Nov 6, 2017
@ScriptFUSION ScriptFUSION deleted a comment from sourcelevel-bot bot Nov 6, 2017
@Bilge Bilge force-pushed the 4.0 branch 2 times, most recently from 765de27 to 40c2815 Compare April 9, 2018 18:51
@Bilge Bilge changed the base branch from 4.0 to master April 9, 2018 21:02
@Bilge Bilge removed this from the 4.0.0 milestone Nov 8, 2019
@Bilge Bilge force-pushed the master branch 3 times, most recently from c394a43 to 372f181 Compare November 16, 2019 11:01
@Bilge Bilge force-pushed the master branch 2 times, most recently from 2308bb2 to 37b143d Compare December 1, 2019 20:42
@Bilge Bilge force-pushed the master branch 9 times, most recently from 1d42981 to fe2764a Compare December 15, 2020 22:32
@Bilge Bilge force-pushed the master branch 26 times, most recently from 8df01f3 to 4cd4dbd Compare December 2, 2022 13:05
@Bilge Bilge force-pushed the master branch 4 times, most recently from 93ce095 to 5898b4c Compare December 8, 2022 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants