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

Order details are no longer working #1507

Closed
Cruiser13 opened this issue Oct 24, 2020 · 3 comments
Closed

Order details are no longer working #1507

Cruiser13 opened this issue Oct 24, 2020 · 3 comments
Assignees
Labels
Milestone

Comments

@Cruiser13
Copy link
Contributor

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

We just updated to coreshop 2.2.6 and now we can no longer open order detail pages for existing orders.

GET | https://protect19.werbeagentur.work/admin/coreshop/order/detail response:

LONG JSON... {"label":"Stornieren","transition":"cancel","color":"#f2583e"}]}],"payments":[],"shipments":[],"paymentCreationAllowed":true,"invoiceCreationAllowed":false,"shipmentCreationAllowed":true,"shippingPayment":{"carrier":"standard","weight":0,"cost":750}}}

Fatal error: Uncaught Symfony\Component\Debug\Exception\ContextErrorException: Warning: ReflectionProperty::setValue(): Cannot assign to an array of nodes (duplicate subnodes or attr detected) in /serverpath/pimcore/vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php:252

@dlhck
Copy link
Contributor

dlhck commented Nov 6, 2020

Hi @Cruiser13 we also experienced that problem. Looks like it is related to pimcore/pimcore#7060 as far as I can see. When working on Pimcore 6.8.x the problem occurs, when working on 6.7.x it is not ...

@dpfaffenbauer would be great to get some feedback of yours here.

@Cruiser13
Copy link
Contributor Author

Following the discussions on gitter the following code makes the order details work again:

services.yml

    AppBundle\EventSubscriber\DeepCopySubscriber:
        public: true

AppBundle\EventSubscriber\DeepCopySubscriber.php

<?php

namespace AppBundle\EventSubscriber;

use DeepCopy\DeepCopy;
use DeepCopy\Filter\Doctrine\DoctrineCollectionFilter;
use DeepCopy\Matcher\PropertyTypeMatcher;
use Pimcore\Event\SystemEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\EventDispatcher\GenericEvent;

class DeepCopySubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents()
    {
        return [
            SystemEvents::SERVICE_PRE_GET_DEEP_COPY => 'addDoctrineCollectionFilter',
        ];
    }

    public function addDoctrineCollectionFilter(GenericEvent $event)
    {
        /**
         * @var DeepCopy $copier
         */
        $copier = $event->getArgument('copier');
        $copier->addFilter(new DoctrineCollectionFilter(), new PropertyTypeMatcher('Doctrine\Common\Collections\Collection'));
        $event->setArgument('copier', $copier);
    }
}


Credits to @ramundomario

@dpfaffenbauer dpfaffenbauer self-assigned this Dec 2, 2020
@dpfaffenbauer dpfaffenbauer added this to the 2.2.6 milestone Dec 2, 2020
@dpfaffenbauer
Copy link
Member

fixed with #1534

@dpfaffenbauer dpfaffenbauer modified the milestones: 2.2.6, 2.2.7 Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants