Comments (14)
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.
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.
Hi, we use 7.0.13+cli and it is affection our production environment at the moment.
from vichuploaderserializationbundle.
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.
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.
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.
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.
What I can say exactly, it is not related to S3. I think it is a cache problem
from vichuploaderserializationbundle.
We deleted our whole symfony cache folder though and the problem still occurred.
from vichuploaderserializationbundle.
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.
@KDederichs Do you have some fresh information about this issue? Is it still actual and reproducible?
from vichuploaderserializationbundle.
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.
Thanks for details
from vichuploaderserializationbundle.
@KDederichs I released version 1.1.1
where added processing post serialization event subscriber. Check please
from vichuploaderserializationbundle.
Related Issues (15)
- Bundle not compliant with JMS/Serializer v2.0.0 HOT 9
- setting url on preSerialize will change field Data HOT 1
- Add option to serialize file as base64
- Symfony Flex support HOT 1
- Cannot autowire service HOT 3
- Support for Symfony Serializer HOT 1
- Support Symfony LTS 4.4 HOT 1
- Serializing an entity manually does not work with the annotated fields. HOT 2
- Add image filter annotation HOT 2
- Support for jms/serializer-bundle@^4.0 HOT 2
- Support PHP attributes HOT 1
- composer req fresh/vich-uploader-serialization-bundle='~3.2' error HOT 1
- Support for jms/serializer-bundle@^5.0
- String at CachedReader::__construct() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vichuploaderserializationbundle.