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

Add Operator to Read the Newest Version of an Object #746

Merged
merged 10 commits into from
Dec 11, 2024

Conversation

cancan101
Copy link
Contributor

@cancan101 cancan101 commented Nov 13, 2024

Based on Alias Operator

Can be used to solve pimcore/pimcore#5322

CC @fashxp

Guided by: https://github.com/orgs/pimcore/discussions/17056
We pass false, per pimcore/pimcore#17059 as we already have object if published and can avoid a disk access.

Will be further improved with: pimcore/pimcore#17728 and pimcore/pimcore#17729 (and more so if Delegate is used)

The first row has a draft version:
image
Grid Options using the new operator:
image

@robertSt7
Copy link
Contributor

@cancan101 Could you please use const and let instead of var? Thanks

@cancan101
Copy link
Contributor Author

done

@cancan101
Copy link
Contributor Author

I can't see what sonarcloud is reporting without logging in to it.

@robertSt7
Copy link
Contributor

@cancan101 We need to add the file path of the VersionGetter here and I got the following error when I try to add it to the event folder grid. Could you please take care of this? Thanks

URL: /admin/object/grid-proxy?classId=EV&folderId=1119
Method: POST
Message: Operator "VersionGetter" is not supported
Trace: 
in /var/www/html/dev/pimcore/admin-ui-classic-bundle/src/DataObject/GridColumnConfig/Service.php:85
#0 /var/www/html/dev/pimcore/admin-ui-classic-bundle/src/DataObject/GridColumnConfig/Service.php(72): Pimcore\Bundle\AdminBundle\DataObject\GridColumnConfig\Service->buildOperator('VersionGetter', Object(stdClass), Array)
#1 /var/www/html/dev/pimcore/admin-ui-classic-bundle/src/DataObject/GridColumnConfig/Service.php(50): Pimcore\Bundle\AdminBundle\DataObject\GridColumnConfig\Service->doBuildConfig(Array, Array, Array)
#2 /var/www/html/dev/pimcore/pimcore/models/DataObject/Service.php(520): Pimcore\Bundle\AdminBundle\DataObject\GridColumnConfig\Service->buildOutputDataConfig(Array, Array)
#3 /var/www/html/dev/pimcore/pimcore/models/DataObject/Service.php(534): Pimcore\Model\DataObject\Service::getConfigForHelperDefinition(Array, '#674dd40e7bb67', Array)
#4 /var/www/html/dev/pimcore/admin-ui-classic-bundle/src/Service/GridData/DataObject.php(81): Pimcore\Model\DataObject\Service::calculateCellValue(Object(Pimcore\Model\DataObject\Event), Array, '#674dd40e7bb67', Array)
#5 /var/www/html/dev/pimcore/admin-ui-classic-bundle/src/Controller/Admin/DataObject/DataObjectActionsTrait.php(132): Pimcore\Bundle\AdminBundle\Service\GridData\DataObject::getData(Object(Pimcore\Model\DataObject\Event), Array, 'en', Array)
#6 /var/www/html/dev/pimcore/admin-ui-classic-bundle/src/Controller/Admin/DataObject/DataObjectController.php(1717): Pimcore\Bundle\AdminBundle\Controller\Admin\DataObject\DataObjectController->gridProxy(Array, 'object', Object(Symfony\Component\HttpFoundation\Request), Object(Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher), Object(Pimcore\Bundle\AdminBundle\Helper\GridHelperService), Object(Pimcore\Localization\LocaleService))
#7 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Pimcore\Bundle\AdminBundle\Controller\Admin\DataObject\DataObjectController->gridProxyAction(Object(Symfony\Component\HttpFoundation\Request), Object(Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher), Object(Pimcore\Bundle\AdminBundle\Helper\GridHelperService), Object(Pimcore\Localization\LocaleService), Object(Pimcore\Bundle\AdminBundle\Security\CsrfProtectionHandler))
#8 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#9 /var/www/html/vendor/symfony/http-kernel/Kernel.php(197): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#10 /var/www/html/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php(35): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#11 /var/www/html/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
#12 /var/www/html/public/index.php(20): require_once('/var/www/html/v...')
#13 {main}```

@cancan101
Copy link
Contributor Author

What is the "event folder grid"?

cancan101 and others added 2 commits December 2, 2024 11:14
Co-authored-by: robertSt7 <104770750+robertSt7@users.noreply.github.com>
@robertSt7
Copy link
Contributor

What is the "event folder grid"?

@cancan101 Thanks for adding the stuff. I mean the folder in the demo, but I got the error also with every other folder.
image

@cancan101
Copy link
Contributor Author

Fixed:
image

@robertSt7 robertSt7 modified the milestones: 1.7.3, 1.8.0 Dec 11, 2024
@robertSt7 robertSt7 merged commit 92c175c into pimcore:1.x Dec 11, 2024
10 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2024
@robertSt7
Copy link
Contributor

@cancan101 Thanks for the improvement

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants