Giter VIP home page Giter VIP logo

Comments (7)

pmclain avatar pmclain commented on July 26, 2024

If you aren’t already planning to do this yourself, I’m up for assisting.

from magento2-cronjobmanager.

Ethan3600 avatar Ethan3600 commented on July 26, 2024

That'd be pretty awesome @pmclain !

from magento2-cronjobmanager.

pmclain avatar pmclain commented on July 26, 2024

@Ethan3600 Here's a first pass at the service contracts and API endpoints pmclain@942b7c8

The lack of [get|set]ters for data properties in \Magento\Cron\Model\Schedule means the class cannot be accepted or returned by Magento's API resolvers :(. To work around this, I added a data interface for Schedule and use two adapters for handling conversions between the core Schedule and the data interface. This looks and feels dirty but was the only solution I could think of that still allowed proper parameter validation for inbound webapi requests and proper self-documenting swagger. The alternative of using an associative array seemed dirtier than the adapters.

In the later versions ScheduleManagementInterface and ScheduleRepositoryInterface would replace usage of the current Manager. In the short term, the majority of the public methods in Manager could call the equivalent method in one of the two Interfaces. I've tinkered with this locally and the result looks something like this pmclain@95b4126

Does this seem like a viable path?

from magento2-cronjobmanager.

Ethan3600 avatar Ethan3600 commented on July 26, 2024

@pmclain this looks like a good plan. Just be cautious about nullable types. We still support PHP 7.0, so that'll break compatibility. Example: pmclain@942b7c8#diff-d6b799b972262a75352441f3573c37b5R25

I get that we're using adapters so that we can return an instance of \EthanYehuda\CronjobManager\Api\Data\ScheduleInterface instead of \Magento\Cron\Model\Schedule, but I don't think I get why.

Can you explain "Magento's API resolvers" a bit more? Specifically why they need those getters and setters? \Magento\Cron\Model\Schedule inherits from AbstractData so I'd assume "magic methods" are fair game, no? Sorry for the knowledge gap 😞

Other than that, I think everything makes sense!

from magento2-cronjobmanager.

pmclain avatar pmclain commented on July 26, 2024

We still support PHP 7.0.

But why? :) I'll update.

Can you explain "Magento's API resolvers" a bit more?

Objects returned by the API are more or less the output of the object's public getters. Magento looks at an object with method getScheduleId and returns an object with the property schedule_id. These public methods are also parsed when generating the swagger documentation http://<magento_host>/swagger. \Magento\Cron\Model\Schedule does not explicitly define any getters, so the data is there but Magento doesn't know that when creating the request response.

from magento2-cronjobmanager.

Ethan3600 avatar Ethan3600 commented on July 26, 2024

I'm a little hesitant since some people may still use PHP 7.0 for Magento 2.2 since Magento still supports it: https://devdocs.magento.com/guides/v2.2/install-gde/system-requirements-tech.html#php

RE API: Ok, this makes sense! Funny how that works.

from magento2-cronjobmanager.

Ethan3600 avatar Ethan3600 commented on July 26, 2024

Closing this issue. See #87

from magento2-cronjobmanager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.