laminas-api-tools / api-tools-admin

Laminas API Tools Admin module
https://api-tools.getlaminas.org/documentation
BSD 3-Clause "New" or "Revised" License
13 stars 21 forks source link

Deprecation Warning for ServiceLocatorAwareInterface #25

Open weierophinney opened 4 years ago

weierophinney commented 4 years ago

With deprecation of ServiceLocatorAwareInterface following classes will raise deprecation warnings:

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.


Originally posted by @JuEger at https://github.com/zfcampus/zf-apigility-admin/issues/332

weierophinney commented 4 years ago

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.

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.


Originally posted by @JuEger at https://github.com/zfcampus/zf-apigility-admin/issues/332#issuecomment-191808551

weierophinney commented 4 years ago

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": "apigility-users@zend.com",
        "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"


Originally posted by @haniWeiss at https://github.com/zfcampus/zf-apigility-admin/issues/332#issuecomment-221661839

weierophinney commented 4 years ago

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


Originally posted by @JuEger at https://github.com/zfcampus/zf-apigility-admin/issues/332#issuecomment-221663386

weierophinney commented 4 years ago

@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:

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.


Originally posted by @TomHAnderson at https://github.com/zfcampus/zf-apigility-admin/issues/332#issuecomment-227831339