I can’t seem to wrap my head around how I would go about adding a file upload to a DataFixture. I’m trying to upload an image for the dummy content my fixtures load. This seems like something that would be useful to know.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’ve found the answer to my question. I need to use the class
Symfony\Component\HttpFoundation\File\Fileto create a File. Symfony will physically move the file and not create a copy so you need to either have a new file for each fixture, use usecopy()to create a copy of the file that can be moved instead.Something like that.