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

Error "setMetaData(): Argument #1 ($metaData) must be of type array, null given" after migration to pimcore 11 #203

Open
APochmann opened this issue Feb 26, 2024 · 1 comment

Comments

@APochmann
Copy link
Contributor

Problem reason

With Pimcore 10 and ProcessManager 4.x there might be monitoring objects in the database without metaData which results in an empty string. In my case this was caused by an command executed via cron job where the code segment

        $monitoringId = $input->getOption('monitoring-item-id');
        $options = ['autoCreate' => true];
        $monitoringItem = $this->initProcessManager($monitoringId, $options);

created such an monitoringItem if no monitoring-item-id was passed.

Problem effect

However, when having such objects in database you will find the error

php.CRITICAL: Uncaught Error: Elements\Bundle\ProcessManagerBundle\Model\MonitoringItem::setMetaData(): Argument #1 ($metaData) must be of type array, null given, called in .../vendor/pimcore/pimcore/lib/Model/AbstractModel.php on line 186

in your log files as since ProcessManager 5.x this parameter is mandatory array. ProcessManager will not load the Process Log

Possible solution

You easily can overcome this issue by running

UPDATE bundle_process_manager_monitoring_item SET `metaData` = "[]" WHERE `metaData` = ''

SQL command on the database.
This could also be put in a migration script or if it's not worth the effort (seems not to happen frequently on migrations as there was no issue raised up to now) you can close this issue as it's anyhow documented here how to solve the problem

@antonio-masotti
Copy link

We're having the same problem after the upgrade to Pimcore 11:

{"message":"Uncaught Error: Elements\Bundle\ProcessManagerBundle\Model\MonitoringItem::setMetaData(): Argument #1 ($metaData) must be of type array, null given, called in /var/www/html/vendor/pimcore/pimcore/lib/Model/AbstractModel.php on line 186","context":{"exception":{"class":"TypeError","message":"Elements\Bundle\ProcessManagerBundle\Model\MonitoringItem::setMetaData(): Argument #1 ($metaData) must be of type array, null given, called in /var/www/html/vendor/pimcore/pimcore/lib/Model/AbstractModel.php on line 186","code":0,"file":"/var/www/html/vendor/elements/process-manager-bundle/src/Model/MonitoringItem.php:209"}},"level":500,"level_name":"CRITICAL","channel":"php","datetime":"2024-03-16T11:23:38.674477+01:00","extra":{"http.url":"","http.method":null,"http.useragent":null,"http.referer":null,"app.env":"int","trace_id":"0","span_id":"0"}}
In MonitoringItem.php line 209:
Elements\Bundle\ProcessManagerBundle\Model\MonitoringItem::setMetaData(): A
rgument #1 ($metaData) must be of type array, null given, called in /var/ww
w/html/vendor/pimcore/pimcore/lib/Model/AbstractModel.php on line 186

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

No branches or pull requests

2 participants