Comments (2)
Well I've been on this a few hours. I first worked on a solution in the controller. This I eventually created:
$form->setRequest($request);
// check all fields of the form
$fname = $form->getName();
foreach($form->getIterator() as $col=>$val)
{
$getter = 'get'.ucfirst(str_replace("_","",$col));
$val = $entity->$getter();
$sess_name = "_spin_file_upload_{$fname}_$col";
// if session was already created
if ($this->get('session')->has($sess_name))
{
if ($val === null)
{
$setter = 'set'.ucfirst(str_replace("_","",$col));
$entity->$setter( ( $this->get('session')->get($sess_name) ) );
}
// remove the session if the form is valid
// note: when the user closes the browser on validation errors the session remains.
if ($form->isValid())
$this->get('session')->set($sess_name, null);
}
// save all images to session, so we can retrieve them if form has validation errors
if ($val instanceof Picture && !$form->isValid())
$this->get('session')->set($sess_name, $val);
}
// continue normal form action
if ($form->isValid())
{
I've also tried to get this same function in the EventSubscriber structure of the forms, but somehow I can't get it to work there.
I hope this helps
from vlabsmediabundle.
Hi,
It looks strange, image in a form is a standard behavior of this bundle. It looks like a configuration error.
Can you please paste me your config for this field ?
from vlabsmediabundle.
Related Issues (20)
- required=true when editing and add_del option with new entity HOT 2
- [New feature] Ink File Picker HOT 4
- Argument 1 passed to Vlabs\MediaBundle\EventListener\BaseFileListener::preSetData() HOT 4
- Issue with an ArrayCollection HOT 3
- How to add custom properties to an Image ? HOT 2
- question about MediaBundle HOT 1
- Calling a filter from a controller HOT 1
- Storing images outside the web root HOT 3
- Argument 1 passed to Vlabs\MediaBundle\EventListener\BaseFileListener::preSetData() HOT 3
- Can I use another Document class? HOT 2
- Setting it up with One to Many relationships
- documentation in yaml. HOT 1
- Add ability to disable file preview
- Event exception
- How to store images from filesystem in entity which extends vlabsfile
- Issue with Gauffrette dependency HOT 1
- The problem is new in Composer.
- Requires "minimum-stability": "dev"? HOT 1
- update to symfony3
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 vlabsmediabundle.