-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Feature plugins framework #4255
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Add custom events for item changes, sales, returns, and inventory. - Add custom events for item and customer csv imports. Signed-off-by: objecttothis <objecttothis@gmail.com>
- Add custom events for item changes, sales, returns, and inventory. - Add custom events for item and customer csv imports. - Refactor variable names for PSR-12 compliance. - Refactor function names for PSR-12 compliance. - Moved retrieving of $employeeId to actually where it's going to be used for readability. - Added trigger point for item save. - Added trigger point for item delete. - Added debug logging for item_change event trigger. - Added itemId to be sent in the item_change event. Signed-off-by: objecttothis <objecttothis@gmail.com>
@@ -65,3 +65,52 @@ | |||
|
|||
$method = new Method(); | |||
Events::on('pre_controller', [$method, 'validate_method']); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jekkos can you think of other events that we want to include?
|
||
echo json_encode(['success' => true, 'message' => $message, 'id' => $item_id]); | ||
Events::trigger('item_change', $itemId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jekkos this is an example of the trigger. It's nice and clean because none of the plugin code gets injected here. Just these triggers.
* This event triggered when an item is changed. This can be an item create, update or delete. | ||
* Plugin functionality is triggered here. | ||
*/ | ||
Events::on('item_change', static function (int $itemId): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$itemId is an example of being able to pass data from the trigger point. So for example, when someone changes an item, it sends the itemId that was changed here and, let's say a plugin decides to make an API call to a website to update the item on the website. In this static function we could call the controller method of the plugin to make the API call. Easy peasy. Plugin Controller code is in it's own space.
The refactoring of variable and function names to camelCase are variables and functions in sections of code I am modifying and are for PSR-12 compliance. |
- Place trigger in Sale Controller. - Refactor variable names to camelCase for PSR-12 compliance - Refactor function names to camelCase for PSR-12 compliance - Minor readability refactoring of if/else to ternary notation - Removed hungarian notation Signed-off-by: objecttothis <objecttothis@gmail.com>
- Refactor function names to camelCase for PSR-12 compliance Signed-off-by: objecttothis <objecttothis@gmail.com>
- This fix properly creates Primary Keys on both MariaDB and MySQL Signed-off-by: objecttothis <objecttothis@gmail.com>
- Migration to create the table in the database - Removed unneeded using statements Signed-off-by: objecttothis <objecttothis@gmail.com>
@jekkos we need to make a few design decisions with this.
The question is how to do 1 and 3 so that weblate does not flip out. Also, do you have any objection to 2? |
- Renamed view from integrations_config to plugins_config.php - Added Plugin - Added todo in the code for refactoring - Refactored config.php strings - Moved mailchimp strings to Plugins.php for en. We will need to do this for all the languages perhaps to retain current translations. - Refactored view to use plugins naming Signed-off-by: objecttothis <objecttothis@gmail.com>
- Renamed view from integrations_config to plugins_config.php - Added Plugin - Added todo in the code for refactoring - Refactored config.php strings - Moved mailchimp strings to Plugins.php for en. We will need to do this for all the languages perhaps to retain current translations. - Refactored view to use plugins naming - Refactored Savefunction name - Refactored view identifiers to be more generic - Added Plugins folders in Controllers, Models and Views - Refactored check_encryption function for PSR-12 compliance Signed-off-by: objecttothis <objecttothis@gmail.com>
I don't know why the following is happening when trying to get a migration.
|
This happened to me the other day but it was because I tried to run a migration when my .env file had already been modified by the upgrade to CI4 which converts encryption from CI3 encryption to CI4 in the database and lengthens the encryption key. I've thought about making it more robust, but really it's a use case that should only be encountered during testing. Are you migrating a clean or pre-existing database? before running the migration did you have a CI3 key or was it a CI4 key? |
I really don't know. I use what db happens to be available at the time. Probably multiple pre-existing ci3 databases. |
This framework provides the custom events which, when triggered, can be used by plugins to make API calls or other read-only data manipulations.