Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

convertToPHPValue should match convertToDatabaseValue #233

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
4 participants

zyjohn commented Nov 23, 2012

convertToPHPValue return resource which is not match default convertToDatabaseValue that not make any change. Change to return content of the resource.

@zyjohn zyjohn Update lib/Doctrine/DBAL/Types/BlobType.php
convertToPHPValue return resource which is not match default convertToDatabaseValue that not make and change. Change to return content of the resource.
feb3023

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DBAL-391

Owner

Ocramius commented Nov 23, 2012

@zyjohn why not retrieving the stream instead? I didn't understand the original point. Could you provide a failing test case that validates this use case?

zyjohn commented Nov 23, 2012

When monitor onFlush event to make a DB journal (compare $entityManager->getUnitOfWork()->getEntityChangeSet($entity), foreach value item[0] as old data, item[1] as new data). If we pass the resource only, the resource is already been read somewhere and the content of the resource is empty. To pass the content value is a simple solution. If you think there is performance issue and prefer to use stream, you need to use rewind($value) whenever you did a stream_get_contents($value) to that resource. Which I don't know how many place should be changed yet.

Owner

guilhermeblanco commented Nov 26, 2012

You should use type="text". Blobs would be keep as resources and applying such as this change would break BC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment