Answer the question
In order to leave comments, you need to log in
Return path to uploaded file in doctrine-entity?
Created a File entity with the file upload implementation, as in the official documentation .
How to use the getWebPath method in the DQL query, which I use to display all records on the page?
It used to be like this CONCAT(photo.folder, photo.filename) filename
, now it needs to be like this
CONCAT('static/', photo.folder, '/', photo.filename) image
photo.webPath image
Answer the question
In order to leave comments, you need to log in
1) the entity should not be able to upload files.
2) why these perversions in DQL? you can do the same in the getter, or even better, pass a service to the getter that will resolve everything you need through a double dispatch:
function getFile(FileResolver $resolver) {
// причем только потому что учавствуют два поля
return $resolver->resolve($this->folder, $this->filename);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question