Comments (7)
If you aren’t already planning to do this yourself, I’m up for assisting.
from magento2-cronjobmanager.
That'd be pretty awesome @pmclain !
from magento2-cronjobmanager.
@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.
@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.
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.
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.
Closing this issue. See #87
from magento2-cronjobmanager.
Related Issues (20)
- Edit Cron Group of Individual Job HOT 5
- Magento 2.4 support HOT 7
- Dashboard entries don't show any information HOT 1
- Assets
- Component\Filters class replaces the original one with missing values HOT 1
- Add "Job-Code" to Filter in Adminhtml HOT 1
- SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock. HOT 2
- Get the ID of the admin user that scheduled the currently running job? HOT 6
- Compatible with PHP 8.1 HOT 2
- PHP 8.1: Deprecated Functionality: Optional parameter $jobId declared before required parameter $jobCode
- PHP 8.1 | Deprecated Functionality: Function strftime() is deprecated... HOT 10
- Magento 2.4.5 - Status Column (html.js) not working HOT 4
- PHP 8.2 / Magento 2.4.6 support HOT 2
- "Required parameter 'theme_dir' was not passed" when I dispatch now a cronjob in backend HOT 3
- Add Total time column in the management grid HOT 3
- Add a feature to reporting "missing" job HOT 4
- Sort by group results in Zend_Db_Statement_Exception HOT 4
- 2.1.0 Not Compatible With Magento < 2.4.6 HOT 8
- Can't execute action Schedule Now Cron Job in Grid Mass Action HOT 2
- Support config_path for cron expressions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magento2-cronjobmanager.