Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Deprecation Warning for ServiceLocatorAwareInterface #332

Open
jeger-at opened this issue Mar 3, 2016 · 5 comments
Open

Deprecation Warning for ServiceLocatorAwareInterface #332

jeger-at opened this issue Mar 3, 2016 · 5 comments

Comments

@jeger-at
Copy link

jeger-at commented Mar 3, 2016

With deprecation of ServiceLocatorAwareInterface following classes will raise deprecation warnings:

  • ZF\Apigility\Admin\Model\AbstractAutodiscoveryModel
  • ZF\Apigility\Admin\Model\DoctrineAdapterResource

Deprecated: ServiceLocatorAwareInterface is deprecated and will be removed in version 3.0, along with the ServiceLocatorAwareInitializer. Please update your class ZF\Apigility\Admin\Model\DoctrineAdapterResource to remove the implementation, and start injecting your dependencies via factory instead.

@jeger-at
Copy link
Author

jeger-at commented Mar 3, 2016

ZF\Apigility\Admin\Model\DoctrineAdapterResource only uses the ServiceManager to get the ModuleManager. It would make sense to replace injection of the ServiceManager with ModuleManager.

  • Remove use of ServiceLocatorAwareInterface (TestCase -> notInstanceOf)
  • Remove setServiceManager and getServiceManager
  • Add setting of ModuleManager (through setter/getter or constructor) (TestCase -> attributeEquals)
  • Inject ModuleManager in Factory

ZF\Apigility\Admin\Model\AbstractAutodiscoveryModel is a bit more tricky since removing ServiceManagerAwareInterface also breaks compatibility in zfcampus/zf-apigility-doctrine.
I would temporary only set the ServiceLocator through the factory and as soon as zfcampus/zf-apigility-doctrine has fixed the issue also remove ServiceLocatorAwareInterface with a new issue.

  • Inject ServiceManager in Factory

@haniWeiss
Copy link

haniWeiss commented May 25, 2016

I had the same deprecation warnings when created new apigility project.
I updated my composer.json file I added the following lines into require:

"php": "^5.6 || ^7.0",
zendframework/zend-mvc": "~2.6.0",

The full composer.json looks like:

{
    "name": "zfcampus/zf-apigility-skeleton",
    "description": "Skeleton Application for Apigility",
    "type": "library",
    "license": "BSD-3-Clause",
    "keywords": [
        "api",
        "apigility",
        "framework",
        "zf2"
    ],
    "homepage": "http://apigility.org/",
    "support": {
        "email": "[email protected]",
        "irc": "irc://irc.freenode.net/apigility",
        "source": "https://github.com/zfcampus/zf-apigility-skeleton",
        "issues": "https://github.com/zfcampus/zf-apigility-skeleton/issues"
    },
    "config": {
        "process-timeout": 5000,
        "github-oauth": {
            "github.com": "7e816679eb7e97bae......xxxxxxxxx"
         }
    },
    "extra": {
        "branch-alias": {
            "dev-master": "1.3-dev",
            "dev-develop": "1.4-dev"
        }
    },
    "require": {
        "php": "^5.6 || ^7.0",
        "zendframework/zendframework": "^2.5.3",
        "zendframework/zend-mvc": "~2.6.0",
        "zfcampus/zf-apigility": "~1.1",
        "zfcampus/zf-apigility-documentation": "^1.0.5",
        "zfcampus/zf-development-mode": "~2.0"
    },
    "require-dev": {
        "zendframework/zftool": "dev-master",
        "zendframework/zend-developer-tools": "dev-master",
        "zfcampus/zf-apigility-admin": "^1.4.1",
        "zfcampus/zf-apigility-admin-ui": "^1.2.3",
        "zfcampus/zf-deploy": "~1.0"
    },
    "suggest": {
        "zfcampus/zf-apigility-doctrine": "zfcampus/zf-apigility-doctrine ~1.0 to create Doctrine-Connected REST services",
        "zfcampus/zf-http-cache": "zfcampus/zf-http-cache ~1.0 to add HTTP caching to your API",
        "zfr/zfr-cors": "zfr/zfr-cors ~1.2 to add CORS support to your API"
    }
}

Please note updating the composer helped to fix the issue "Hydrator Service issue #334"

@jeger-at
Copy link
Author

This is only a workaround. Not the solution for cb with future versions of zf.

@TomHAnderson
Copy link
Contributor

@weierophinney @ezimuel I started to do work on zf-apigility-doctrine to remove the ServiceLocatorAwareInterface and was quickly stopped at this project: https://github.com/zfcampus/zf-apigility-admin/blob/master/src/Model/AbstractAutodiscoveryModel.php

I need to know a priority for Apigility:

  • Let the project stay where it is. Don't update for SM3.
  • Update for SM3 and continue in the current ZF2 skeleton paradigm.
  • Create a new initiative to move Apigility into PSR-7 compliance.
  • Something else?

I think the right approach is to make Apigility SM3 compliant and start a new initiative after ZendCon to bring Apigility inline with today's practices.

For zf-apigility-doctrine I've created a work around for the problem of DoctrineModule not supporting zend-hydrator and I'm ready to move the project forward. Without a consensus doing that work could lead to a dead end.

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas-api-tools/api-tools-admin; a new issue has been opened at laminas-api-tools/api-tools-admin#25.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants