Skip to content
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

Open
wants to merge 17 commits into
base: 1.3.x
Choose a base branch
from
Open

Conversation

delamux
Copy link
Collaborator

@delamux delamux commented Feb 17, 2024

  • Refactor and remove deprecated methods

@delamux delamux requested a review from steinkel February 17, 2024 14:59
src/Utility/NotificationManager.php Show resolved Hide resolved
}

foreach ((array)$data['users'] as $user) {
$entity = $model->newEntity();
$model->saveMany($entities);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if save fails?

Copy link
Collaborator Author

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);

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']);
Copy link
Collaborator Author

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

}

foreach ((array)$data['users'] as $user) {
$entity = $model->newEntity();
$model->saveMany($entities);
Copy link
Collaborator Author

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.

@delamux delamux requested a review from steinkel February 20, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants