Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Deprecate ResourceInterface::getResource()#15719

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:2.8fromwebfactory:remove-get-resource-from-resource-interface
Sep 26, 2015
Merged

Deprecate ResourceInterface::getResource()#15719

fabpot merged 1 commit intosymfony:2.8fromwebfactory:remove-get-resource-from-resource-interface
Sep 26, 2015

Conversation

mpdude
Copy link
Contributor

QA
Bug fix?no
New feature?no
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PRn/a

The return value of this method does not make sense if you do not exactly know about the type of resource at hand. For example, it may bean array or afile path.

As all usages of getResource() within Symfony are in tests of particular Resource implementations anyway, deprecating and later removing this method helps us with simplifying the ResourceInterface (#7176).

@stof
Copy link
Member

stof commentedSep 8, 2015

I think we need to introduce a whole new resource system, which would move the checking of freshness outside the resource (it is not possible to implement such feature in the existing interface). As such, I don't think we need to deprecate part of the interface now (we should deprecate the whole interface when implementing the new system)

@mpdude
Copy link
ContributorAuthor

@stof please see#15692#15738, I think we can make it with refactorings.

@stof
Copy link
Member

stof commentedSep 8, 2015

@mpdude the issue is thatResourceInterface::isFresh simply cannot be implemented for the new system, as resources don't have the necessary info to check themselves (in the general case).
This is why we need a new API, with a new interface (and the new interface should be enforced to be Serializable IMO).

@mpdude
Copy link
ContributorAuthor

@stof#15692#15738 tries to shift resource validation to services which are calledMetadataValidator there.

For resources implementingResourceInterface, a generic validator can be used and it needs theisFresh method.

If we removeResourceInterface::getResource() because we don't need it, the only requirement for resources in thegeneral case is to implement__toString which is needed for de-duplication.

So, we could extract that into a base interface (ResourceMetadata,CacheMetadata or ...?) and make this base interface the only requirement for resources.

@stof
Copy link
Member

stof commentedSep 8, 2015

@mpdude a resource should also be serializable, as we serialize it in the meta file. This is why I think we need a new interface (freeing us from BC on the interface itself), with an implementation wrapping the existing ResourceInterface.

@mpdude
Copy link
ContributorAuthor

Is it really necessary to extend \Serializable? What difference does it make?

@stof
Copy link
Member

stof commentedSep 8, 2015

@mpdude makig sure resources are actually serializable (people broke things in the past when putting a PDO instance in their own resources as this would not make them serializable anymore)

@mpdude
Copy link
ContributorAuthor

Yes, but they will find out rather quickly and still can implement \Serializable, not?

For most simple resources that work fine with the built-in serialization mechanism, I'd like to avoid the hassle of having to implement __sleep and __wakeup. Plus it's not a BC issue onResourceInterface which works withoutSerializable right now, and changing that is hard (or even impossible).

@stof
Copy link
Member

stof commentedSep 8, 2015

@mpdude if you don't implement Serializable, it also means you are not allowed to modify your class anymore, because it would break BC for the unserialization of existing meta. This is why core resources are serializable btw (and also to reduce the size of the serialized data)

@mpdude
Copy link
ContributorAuthor

ping@fabpot / @symfony/deciders

@fabpot
Copy link
Member

needs a rebase

The return value of this method does not make sense if you do not exactly knowabout the type of resource at hand. For example, it may be [an array](https://github.com/symfony/symfony/blob/b49fa129bdb3c0aa970a006b16dd1ca63a9d7ebd/src/Symfony/Component/HttpKernel/Config/EnvParametersResource.php#L57)or a [file path](https://github.com/symfony/symfony/blob/87800ae47e64429f2544b798575d1cc1d4e5464a/src/Symfony/Component/Config/Resource/FileResource.php#L51).As all usages of getResource() within Symfony are in tests of particular Resource implementations anyway, deprecating and later removing this interfacehelps us with simplifying the ResourceInterface (#7176).
@mpdude
Copy link
ContributorAuthor

Rebased.

@fabpot
Copy link
Member

Do we really need to keep this interface for 3.0?

@mpdude
Copy link
ContributorAuthor

We need the __toString() for resource deduplication, plus there are@api interfaces that use it for type hints.

@fabpot
Copy link
Member

Thank you@mpdude.

@fabpotfabpot merged commit87c0c7d intosymfony:2.8Sep 26, 2015
fabpot added a commit that referenced this pull requestSep 26, 2015
This PR was merged into the 2.8 branch.Discussion----------Deprecate ResourceInterface::getResource()| Q             | A| ------------- | ---| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        | n/aThe return value of this method does not make sense if you do not exactly know about the type of resource at hand. For example, it may be [an array](https://github.com/symfony/symfony/blob/b49fa129bdb3c0aa970a006b16dd1ca63a9d7ebd/src/Symfony/Component/HttpKernel/Config/EnvParametersResource.php#L57) or a [file path](https://github.com/symfony/symfony/blob/87800ae47e64429f2544b798575d1cc1d4e5464a/src/Symfony/Component/Config/Resource/FileResource.php#L51).As all usages of getResource() within Symfony are in tests of particular Resource implementations anyway, deprecating and later removing this method helps us with simplifying the ResourceInterface (#7176).Commits-------87c0c7d Deprecate ResourceInterface::getResource()
@mpdudempdude deleted the remove-get-resource-from-resource-interface branchSeptember 26, 2015 08:35
fabpot added a commit that referenced this pull requestSep 28, 2015
…which was deprecated in 2.8 (mpdude)This PR was squashed before being merged into the 3.0-dev branch (closes#15929).Discussion----------[3.0][Config] Remove ResourceInterface::getResource() which was deprecated in 2.8| Q             | A| ------------- | ---| Bug fix?      | no| New feature?  | no| BC breaks?    | yes| Deprecations? | no| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        |Deprecated in#15719.Commits-------7cef180 [3.0][Config] Remove ResourceInterface::getResource() which was deprecated in 2.8
@fabpotfabpot mentioned this pull requestNov 16, 2015
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@mpdude@stof@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp