0
votes

I am trying to develop a Symfony2 API using the FOSRestBundle but I am stuck with an error regarding the serialization of one of my Doctrine entity (I'm using the JMS Serializer bundle for serialization).

The error message is the following : "Resources are not supported in serialized data"

The serialization worked until I made my entity implement a custom interface :

/**
 * Quotation
 *
 * @ORM\Table(name="quotation")
 * @ORM\Entity
 */
class Quotation implements FileStorageInterface
{
    // content
}

And the interface :

interface FileStorageInterface
{
    public function getFile();

    public function setFile($file);
}

I searched online but couldn't find anything about serializing an entity implementing an interface. So if anyone has an idea on how to solve this, I would gladly accept it.

1
Did I understand you right: if you drop string implements FileStorageInterface without any other manipulation everything is working fine?Michael Sivolobov
That's exactly that !timothy.B

1 Answers

1
votes

The problem is not specifically because you are implementing just any interface, but because the object's data contains a resource. Having a look at the interface in question, I suspect dat setFile() is being called with a resource as value and stored on a property of the object.