0

I'd like to know if there is a way to directly store a PHP resource in Doctrine ODM, something like :

$document->setFile($resource);

Or if first have to write it to a temporary file and then use it in setFile().

Thanks for your help !

ovesco
  • 633
  • 1
  • 8
  • 22

1 Answers1

0

I haven't used GridFS much, but looking at the code you could create instance of GridFSFile in your setter without providing constructor argument and later call ->setBytes() method to set what is to be written.

malarzm
  • 2,831
  • 2
  • 15
  • 25
  • Hey, thanks for your reply, but I think that `setBytes` is meant to receive a file path, while `setFile()` is the one used to store a resource, which is not implemented by the Doctrine GridFSFile, and I cant do something like `$gf->setBytes(stream_get_content($resource))` because I'm low on memory :/ – ovesco Apr 30 '16 at 14:34