Giter Club home page Giter Club logo

Comments (14)

KDederichs avatar KDederichs commented on September 23, 2024

Just an afterthought, is it maybe possible that the reflection messes things up?
Like if the doctrine object is flushed and immediately after serialized is there a chance that the reflection happens before the flush action is complete? (There also is a cascade={persist} annotation in one of the entities)

from vichuploaderserializationbundle.

fre5h avatar fre5h commented on September 23, 2024

Hi. What version of PHP do you use? And do you have this error in production environment only or in dev env also?

from vichuploaderserializationbundle.

KDederichs avatar KDederichs commented on September 23, 2024

Hi, we use 7.0.13+cli and it is affection our production environment at the moment.

from vichuploaderserializationbundle.

fre5h avatar fre5h commented on September 23, 2024

I have not used this bundle with PHP 7.0+ in production. Tests are passed for PHP 7.0 in Travis. But in my projects still PHP 5.6. So I didn't have same problem as you.
So what can it be. Maybe different way of reflection in PHP 7.0. Or maybe some problem with cached annotations. If you use cache for annotations then try to clear it after bug appeared and check if it has gone. Anyway I need some workflow how to reproduce this issue

from vichuploaderserializationbundle.

KDederichs avatar KDederichs commented on September 23, 2024

I'll try to make one you can replicate:

First of the issue didn't appear for like 2 month so I assume it only appears if you either have a bit of data in your DB or if there is more load on the servers so operations need a tiny bit longer.

The updating of the product, which has the images, happens in controllers that persist and flush around 4 or 5 entities and immediately after serialize an entity which contains a product.

The general flow is:

I persist 4 entities A,B,C,D.

Entity A has a reference to Entity B.
Entity B has a cascade persist annotation which updates an entity (E) that contains my Product.

Immediately after the flush I serialize entity A with a serialization group that exposes entities B and E.

from vichuploaderserializationbundle.

fre5h avatar fre5h commented on September 23, 2024

So if you can reproduce this issue, have you debug it locally? Put a breakpoint here https://github.com/fre5h/VichUploaderSerializationBundle/blob/master/EventListener/JmsPreSerializeListener.php#L125 And see URL is duplicated

from vichuploaderserializationbundle.

KDederichs avatar KDederichs commented on September 23, 2024

So I debugged it at that line and when there is only the filename in the database the uri looks like
https://s3..../name.png
when you run the script again it will be
https://s3..../https://s3....../name.png
and so on.

from vichuploaderserializationbundle.

fre5h avatar fre5h commented on September 23, 2024

What I can say exactly, it is not related to S3. I think it is a cache problem

from vichuploaderserializationbundle.

KDederichs avatar KDederichs commented on September 23, 2024

We deleted our whole symfony cache folder though and the problem still occurred.

from vichuploaderserializationbundle.

KDederichs avatar KDederichs commented on September 23, 2024

screenshot from 2017-03-23 13-10-35

Here is a screenshot from the debugger if that helps, the thing I want to persist is the order but somehow it will also persist the imagename of the product

from vichuploaderserializationbundle.

fre5h avatar fre5h commented on September 23, 2024

@KDederichs Do you have some fresh information about this issue? Is it still actual and reproducible?

from vichuploaderserializationbundle.

KDederichs avatar KDederichs commented on September 23, 2024

It should be reproducible like this:

You have some entity that has the VichSerializableField annotation (Entity A) and some entity with a relation to it you are editing at the moment (Entity B).

Now what you are doing is you persist Entity B and directly after that you serialize it (in my case because you want to send it somewhere to announce it).
What will happen since you use reflection to overwrite the original data of Entity A with the FQDN it will pickup on these changes and persist them as well, causing an endless appending of the URL.

What I ended up doing to 'fix' it is I wrote a virtual property containing my URL with placeholders which I then replace with my final data in an Event subscriber. Since it's a virtual property it's not mapped and can't be persisted back into my database.

from vichuploaderserializationbundle.

fre5h avatar fre5h commented on September 23, 2024

Thanks for details

from vichuploaderserializationbundle.

fre5h avatar fre5h commented on September 23, 2024

@KDederichs I released version 1.1.1 where added processing post serialization event subscriber. Check please

from vichuploaderserializationbundle.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.