Search Results

Search found 1 results on 1 pages for 'madarco'.

Page 1/1 | 1 

  • How to suppress a MongoDDException when proxy can't find a referenced document

    - by Madarco
    We are using Symfony2/DoctrineOdm/MongoDB and when we do: if ($doc.referenceOne != null) { ... } and the $doc.referenceOne contains a MongoDbRef that point to a deleted/lost document, the Doctrine Proxy object raises a MongoDBException. It is possible to tell the Proxy return null instead of raising the exception? Detailed Explanation: Our document: class User { /* @MongoDB\ReferenceOne( ... ) */ private $photo; } If $photo contains a MongoDbRef, but the document is lost/deleted, when we do if ($user.photo) { ... } doctrine will raise a MongoDBException: The "Proxies\DocumentPhotoProxy" document with identifier "4fd8b3ef732bafab7b000000" could not be found We want to suppress the exception since our application can handle null values in that variable. (we could simply log that error, while the exception propagate to a 500 page and disrupt our service)

    Read the article

1