-
Notifications
You must be signed in to change notification settings - Fork 0
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
Deprecate methods #2
base: 1.3.x
Are you sure you want to change the base?
Conversation
delamux
commented
Feb 17, 2024
- Refactor and remove deprecated methods
src/Utility/NotificationManager.php
Outdated
} | ||
|
||
foreach ((array)$data['users'] as $user) { | ||
$entity = $model->newEntity(); | ||
$model->saveMany($entities); |
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.
what if save fails?
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.
good point, I will handle the error.
$item->set('state', 0); | ||
$model->save($item); | ||
$item->set('state', Notification::READ_STATUS); | ||
$this->table->save($item); |
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.
what if save fails?
foreach ((array)$data['users'] as $userId) { | ||
$finalData = array_merge($data, ['user_id' => $userId]); | ||
$entity = $model->newEntity($finalData); | ||
$entity->set('vars', $data['vars']); |
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.
By the way, I needed it to do this because for any reason, passing the data in the newEntities with the arrays of arrays was not entering in the property 'vars' of the Entity which is in charge of jsonEncode. Was setting up the vars as empty string
src/Utility/NotificationManager.php
Outdated
} | ||
|
||
foreach ((array)$data['users'] as $user) { | ||
$entity = $model->newEntity(); | ||
$model->saveMany($entities); |
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.
good point, I will handle the error.