Skip to content
This repository

clean up exceptions handling #354

Merged
merged 1 commit into from 7 months ago

3 participants

David Buchmann Lukas Kahwe Smith dantleech
David Buchmann
Collaborator
dbu commented October 04, 2013

fix PHPCR-71

there are small BC breaks involved when catching exceptions:

  • Moved MissingTranslationException from Exception to Translation namespace
  • Removed Phpcr prefix from standard exceptions BadMethodCall and InvalidArgument
David Buchmann dbu commented on the diff October 04, 2013
lib/Doctrine/ODM/PHPCR/Exception/MissingTranslationException.php
((17 lines not shown))
17  
-     * <http://www.doctrine-project.org>.
18  
-     */
19  
-
20  
-namespace Doctrine\ODM\PHPCR\Exception;
21  
-
22  
-use Doctrine\ODM\PHPCR\PHPCRException;
23  
-
24  
-/**
25  
- * Missing translation exception class
26  
- *
27  
- * @license     http://www.opensource.org/licenses/MIT-license.php MIT license
28  
- * @link        www.doctrine-project.com
29  
- * @since       1.0
30  
- * @author      Lukas Kahwe Smith <smith@pooteeweet.org>
31  
- */
32  
-class MissingTranslationException extends PHPCRException
1
David Buchmann Collaborator
dbu added a note October 04, 2013

moved to Translation namespace for consistency with IdException, MappingException and QueryException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
lib/Doctrine/ODM/PHPCR/Exception/InvalidArgumentException.php
((13 lines not shown))
28 24
  */
29  
-class PHPCRInvalidArgumentException extends PHPCRException
  25
+class InvalidArgumentException extends \InvalidArgumentException implements PhpcrExceptionInterface
3

Just to be annoying .. in Doctrine-land shouldn't we be talking about PHPCRExceptionInterface ?

David Buchmann Collaborator
dbu added a note October 04, 2013

i thought we said we go for the camelcase everywhere we still can.

Lukas Kahwe Smith Collaborator
lsmith77 added a note October 04, 2013

no .. we said that for Doctrine we comply with their naming scheme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
lib/Doctrine/ODM/PHPCR/Id/IdException.php
... ...
@@ -2,9 +2,9 @@
2 2
 
3 3
 namespace Doctrine\ODM\PHPCR\Id;
4 4
 
5  
-use Doctrine\ODM\PHPCR\PHPCRException;
  5
+use Doctrine\ODM\PHPCR\PhpcrException;
3

Is it the Doctrine standard to put the base exception in the parent namespace ?

David Buchmann Collaborator
dbu added a note October 04, 2013

it is in the main namespace. i did not dare moving it anywhere else, for fear of BC breaks. is that not where it belongs?

Lukas Kahwe Smith Collaborator
lsmith77 added a note October 04, 2013

its fine for me .. question is more if we want to have an exception that is not specific like PHPCRException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
David Buchmann
Collaborator
dbu commented October 04, 2013

@lsmith77 any input on this? would love to merge this tomorrow so that we have a few days to see if we run into any issues before going stable...

Lukas Kahwe Smith
Collaborator

this to need a rebase and tests are not passing.

aside from this i think it should be PHPCRException .. though i think we should ideally also get rid of the class entirely and use specialized exception classes instead

David Buchmann
Collaborator
dbu commented October 04, 2013

the test fail is a travis dns hickup, 5 or 6 builds are green.

i will soon rebase. i guess i will then rename back to PHPCRException. should it also be PHPCRExceptionInterface or is that one fine as is? i don't want to remove that excpetion really at this point. its quite a bc break for everything that is currently catching exceptions. and if we talk similar architecture as the orm, there is https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/ORMException.php

Lukas Kahwe Smith
Collaborator

ok for keeping .. and yes it should also be PHPCRExceptionInterface

David Buchmann
Collaborator
dbu commented October 05, 2013

okay, rebased and restored name to PHPCRException. we will have to test the sandbox once merged. a quick search found no indication that we ever try-catch any PHPCRException or used PHPCRBadMethodCallException or PHPCRInvalidArgumentException so it should be fine.

Lukas Kahwe Smith lsmith77 merged commit 5286d16 into from October 05, 2013
Lukas Kahwe Smith lsmith77 closed this October 05, 2013
Lukas Kahwe Smith lsmith77 deleted the branch October 05, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 05, 2013
David Buchmann clean up exceptions handling. fix PHPCR-71 89a6e5c
This page is out of date. Refresh to see the latest.

Showing 45 changed files with 295 additions and 237 deletions. Show diff stats Hide diff stats

  1. 7  CHANGELOG.md
  2. 2  lib/Doctrine/ODM/PHPCR/Configuration.php
  3. 3  lib/Doctrine/ODM/PHPCR/Document/File.php
  4. 4  lib/Doctrine/ODM/PHPCR/Document/Resource.php
  5. 93  lib/Doctrine/ODM/PHPCR/DocumentManager.php
  6. 4  lib/Doctrine/ODM/PHPCR/DocumentRepository.php
  7. 10  lib/Doctrine/ODM/PHPCR/{PHPCRRuntimeException.php → Exception/BadMethodCallException.php}
  8. 5  lib/Doctrine/ODM/PHPCR/Exception/CascadeException.php
  9. 10  lib/Doctrine/ODM/PHPCR/{PHPCRInvalidArgumentException.php → Exception/InvalidArgumentException.php}
  10. 34  lib/Doctrine/ODM/PHPCR/Exception/MissingTranslationException.php
  11. 29  lib/Doctrine/ODM/PHPCR/Exception/OutOfBoundsException.php
  12. 29  lib/Doctrine/ODM/PHPCR/Exception/RuntimeException.php
  13. 2  lib/Doctrine/ODM/PHPCR/Id/AssignedIdGenerator.php
  14. 4  lib/Doctrine/ODM/PHPCR/Id/IdGenerator.php
  15. 5  lib/Doctrine/ODM/PHPCR/Id/RepositoryIdGenerator.php
  16. 5  lib/Doctrine/ODM/PHPCR/Mapping/ClassMetadata.php
  17. 3  lib/Doctrine/ODM/PHPCR/Mapping/MappingException.php
  18. 8  lib/Doctrine/ODM/PHPCR/PHPCRException.php
  19. 27  lib/Doctrine/ODM/PHPCR/PHPCRExceptionInterface.php
  20. 7  lib/Doctrine/ODM/PHPCR/Query/Builder/AbstractLeafNode.php
  21. 43  lib/Doctrine/ODM/PHPCR/Query/Builder/AbstractNode.php
  22. 17  lib/Doctrine/ODM/PHPCR/Query/Builder/BuilderConverterPhpcr.php
  23. 23  lib/Doctrine/ODM/PHPCR/Query/Builder/QueryBuilder.php
  24. 12  lib/Doctrine/ODM/PHPCR/Query/Builder/SourceFactory.php
  25. 1  lib/Doctrine/ODM/PHPCR/Query/QueryException.php
  26. 1  lib/Doctrine/ODM/PHPCR/ReferenceManyCollection.php
  27. 7  lib/Doctrine/ODM/PHPCR/Tools/Test/QueryBuilderTester.php
  28. 2  lib/Doctrine/ODM/PHPCR/Translation/LocaleChooser/LocaleChooser.php
  29. 2  lib/Doctrine/ODM/PHPCR/Translation/LocaleChooser/LocaleChooserInterface.php
  30. 9  lib/Doctrine/ODM/PHPCR/{PHPCRBadMethodCallException.php → Translation/MissingTranslationException.php}
  31. 45  lib/Doctrine/ODM/PHPCR/UnitOfWork.php
  32. 6  tests/Doctrine/Tests/ODM/PHPCR/Functional/BasicCrudTest.php
  33. 8  tests/Doctrine/Tests/ODM/PHPCR/Functional/DetachTest.php
  34. 2  tests/Doctrine/Tests/ODM/PHPCR/Functional/FlushTest.php
  35. 4  tests/Doctrine/Tests/ODM/PHPCR/Functional/MergeTest.php
  36. 18  tests/Doctrine/Tests/ODM/PHPCR/Functional/QueryBuilderTest.php
  37. 3  tests/Doctrine/Tests/ODM/PHPCR/Functional/ReferenceTest.php
  38. 2  tests/Doctrine/Tests/ODM/PHPCR/Functional/RefreshTest.php
  39. 4  tests/Doctrine/Tests/ODM/PHPCR/Functional/ReorderTest.php
  40. 12  tests/Doctrine/Tests/ODM/PHPCR/Functional/Translation/DocumentManagerTest.php
  41. 8  tests/Doctrine/Tests/ODM/PHPCR/Functional/Versioning/VersioningTest.php
  42. 2  tests/Doctrine/Tests/ODM/PHPCR/Id/IdGeneratorTest.php
  43. 2  tests/Doctrine/Tests/ODM/PHPCR/Query/Builder/AbstractLeafNodeTest.php
  44. 4  tests/Doctrine/Tests/ODM/PHPCR/Query/Builder/BuilderConverterPhpcrTest.php
  45. 4  tests/Doctrine/Tests/ODM/PHPCR/Translation/LocaleChooserTest.php
7  CHANGELOG.md
Source Rendered
... ...
@@ -1,6 +1,13 @@
1 1
 Changelog
2 2
 =========
3 3
 
  4
+* **2013-10-04**: Exception cleanup: Added a PHPCRExceptionInterface that all
  5
+  Exceptions implement. Standard exceptions now extend their base Exceptions.
  6
+
  7
+  - Moved MissingTranslationException from Exception to Translation namespace
  8
+  - Removed Phpcr prefix from standard exceptions BadMethodCall and InvalidArgument
  9
+  - Added OutOfBounds and Runtime exceptions
  10
+
4 11
 1.0.0-RC2
5 12
 ---------
6 13
 
2  lib/Doctrine/ODM/PHPCR/Configuration.php
@@ -217,7 +217,7 @@ public function setProxyDir($dir)
217 217
     public function getProxyDir()
218 218
     {
219 219
         if (!isset($this->attributes['proxyDir'])) {
220  
-            $this->attributes['proxyDir'] = \sys_get_temp_dir();
  220
+            $this->attributes['proxyDir'] = sys_get_temp_dir();
221 221
         }
222 222
 
223 223
         return $this->attributes['proxyDir'];
3  lib/Doctrine/ODM/PHPCR/Document/File.php
@@ -19,6 +19,7 @@
19 19
 
20 20
 namespace Doctrine\ODM\PHPCR\Document;
21 21
 
  22
+use Doctrine\ODM\PHPCR\Exception\RuntimeException;
22 23
 use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
23 24
 
24 25
 /**
@@ -46,7 +47,7 @@ public function setFileContentFromFilesystem($filename)
46 47
         $this->getContent();
47 48
         $stream = fopen($filename, 'rb');
48 49
         if (! $stream) {
49  
-            throw new \RuntimeException("File '$filename' not found");
  50
+            throw new RuntimeException("File '$filename' not found");
50 51
         }
51 52
 
52 53
         $this->content->setData($stream);
4  lib/Doctrine/ODM/PHPCR/Document/Resource.php
@@ -19,7 +19,7 @@
19 19
 
20 20
 namespace Doctrine\ODM\PHPCR\Document;
21 21
 
22  
-use Doctrine\ODM\PHPCR\PHPCRBadMethodCallException;
  22
+use Doctrine\ODM\PHPCR\Exception\BadMethodCallException;
23 23
 use PHPCR\NodeInterface;
24 24
 
25 25
 use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
@@ -159,7 +159,7 @@ public function getData()
159 159
     public function getSize()
160 160
     {
161 161
         if (null === $this->node) {
162  
-            throw new PHPCRBadMethodCallException('Do not call Resource::getSize on unsaved objects, as it only reads the stored size.');
  162
+            throw new BadMethodCallException('Do not call Resource::getSize on unsaved objects, as it only reads the stored size.');
163 163
         }
164 164
 
165 165
         return $this->node->getProperty('jcr:data')->getLength();
93  lib/Doctrine/ODM/PHPCR/DocumentManager.php
@@ -20,7 +20,8 @@
20 20
 namespace Doctrine\ODM\PHPCR;
21 21
 
22 22
 use Doctrine\Common\Collections\Collection;
23  
-use Doctrine\ODM\PHPCR\Exception\MissingTranslationException;
  23
+use Doctrine\ODM\PHPCR\Translation\MissingTranslationException;
  24
+use Doctrine\ODM\PHPCR\Exception\InvalidArgumentException;
24 25
 use Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory;
25 26
 use Doctrine\ODM\PHPCR\Proxy\ProxyFactory;
26 27
 use Doctrine\Common\EventManager;
@@ -147,12 +148,12 @@ public function setTranslationStrategy($key, TranslationStrategyInterface $strat
147 148
      *
148 149
      * @return Translation\TranslationStrategy\TranslationStrategyInterface
149 150
      *
150  
-     * @throws PHPCRInvalidArgumentException if there is no strategy registered with the given key
  151
+     * @throws InvalidArgumentException if there is no strategy registered with the given key
151 152
      */
152 153
     public function getTranslationStrategy($key)
153 154
     {
154 155
         if (!isset($this->translationStrategy[$key])) {
155  
-            throw new PHPCRInvalidArgumentException("You must set a valid translator strategy for a document that contains translatable fields ($key is not a valid strategy or was not previously registered)");
  156
+            throw new InvalidArgumentException("You must set a valid translator strategy for a document that contains translatable fields ($key is not a valid strategy or was not previously registered)");
156 157
         }
157 158
 
158 159
         return $this->translationStrategy[$key];
@@ -177,7 +178,7 @@ public function hasLocaleChooserStrategy()
177 178
     public function getLocaleChooserStrategy()
178 179
     {
179 180
         if (!isset($this->localeChooserStrategy)) {
180  
-            throw new PHPCRInvalidArgumentException("You must configure a language chooser strategy when having documents with the translatable annotation");
  181
+            throw new InvalidArgumentException("You must configure a language chooser strategy when having documents with the translatable annotation");
181 182
         }
182 183
 
183 184
         return $this->localeChooserStrategy;
@@ -545,7 +546,7 @@ public function createQuery($statement, $language)
545 546
      *
546 547
      * Query returned by QueryBuilder::getQuery()
547 548
      *
548  
-     * @return Builder\QueryBuilder
  549
+     * @return QueryBuilder
549 550
      */
550 551
     public function createQueryBuilder()
551 552
     {
@@ -615,12 +616,12 @@ public function getDocumentsByPhpcrQuery(QueryInterface $query, $className = nul
615 616
      *
616 617
      * @param object $document the document to persist
617 618
      *
618  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  619
+     * @throws InvalidArgumentException if $document is not an object.
619 620
      */
620 621
     public function persist($document)
621 622
     {
622 623
         if (!is_object($document)) {
623  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  624
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
624 625
         }
625 626
 
626 627
         $this->errorIfClosed();
@@ -635,13 +636,13 @@ public function persist($document)
635 636
      * @param object $document the document to persist a translation of
636 637
      * @param string $locale   the locale this document currently has
637 638
      *
638  
-     * @throws PHPCRInvalidArgumentException if $document is not an object or not managed.
  639
+     * @throws InvalidArgumentException if $document is not an object or not managed.
639 640
      * @throws PHPCRException if the document is not translatable
640 641
      */
641 642
     public function bindTranslation($document, $locale)
642 643
     {
643 644
         if (!is_object($document)) {
644  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  645
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
645 646
         }
646 647
 
647 648
         $this->errorIfClosed();
@@ -654,12 +655,12 @@ public function bindTranslation($document, $locale)
654 655
      * @param object $document the document to persist a translation of
655 656
      * @param string $locale   the locale this document currently has
656 657
      *
657  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  658
+     * @throws InvalidArgumentException if $document is not an object.
658 659
      */
659 660
     public function removeTranslation($document, $locale)
660 661
     {
661 662
         if (!is_object($document)) {
662  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  663
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
663 664
         }
664 665
 
665 666
         $this->errorIfClosed();
@@ -675,13 +676,13 @@ public function removeTranslation($document, $locale)
675 676
      *
676 677
      * @return array of strings with all locales existing for this particular document
677 678
      *
678  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  679
+     * @throws InvalidArgumentException if $document is not an object.
679 680
      * @throws MissingTranslationException   if the document is not translatable
680 681
      */
681 682
     public function getLocalesFor($document, $includeFallbacks = false)
682 683
     {
683 684
         if (!is_object($document)) {
684  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  685
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
685 686
         }
686 687
 
687 688
         $this->errorIfClosed();
@@ -728,12 +729,12 @@ public function isDocumentTranslatable($document)
728 729
      * @param object $document   an already registered document
729 730
      * @param string $targetPath the target path including the nodename
730 731
      *
731  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  732
+     * @throws InvalidArgumentException if $document is not an object.
732 733
      */
733 734
     public function move($document, $targetPath)
734 735
     {
735 736
         if (!is_object($document)) {
736  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  737
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
737 738
         }
738 739
 
739 740
         if (strpos($targetPath, '/') !== 0) {
@@ -756,12 +757,12 @@ public function move($document, $targetPath)
756 757
      * @param string  $targetName the nodename of the target of the reordering
757 758
      * @param boolean $before     whether to move before or after the target
758 759
      *
759  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  760
+     * @throws InvalidArgumentException if $document is not an object.
760 761
      */
761 762
     public function reorder($document, $srcName, $targetName, $before)
762 763
     {
763 764
         if (!is_object($document)) {
764  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  765
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
765 766
         }
766 767
 
767 768
         $this->errorIfClosed();
@@ -777,12 +778,12 @@ public function reorder($document, $srcName, $targetName, $before)
777 778
      *
778 779
      * @param object $document
779 780
      *
780  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  781
+     * @throws InvalidArgumentException if $document is not an object.
781 782
      */
782 783
     public function remove($document)
783 784
     {
784 785
         if (!is_object($document)) {
785  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  786
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
786 787
         }
787 788
 
788 789
         $this->errorIfClosed();
@@ -805,12 +806,12 @@ public function remove($document)
805 806
      * @return object The managed document where $document has been merged
806 807
      *      into. This is *not* the same instance as the parameter.
807 808
      *
808  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  809
+     * @throws InvalidArgumentException if $document is not an object.
809 810
      */
810 811
     public function merge($document)
811 812
     {
812 813
         if (!is_object($document)) {
813  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  814
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
814 815
         }
815 816
 
816 817
         $this->errorIfClosed();
@@ -828,12 +829,12 @@ public function merge($document)
828 829
      *
829 830
      * @param object $document The object to detach.
830 831
      *
831  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  832
+     * @throws InvalidArgumentException if $document is not an object.
832 833
      */
833 834
     public function detach($document)
834 835
     {
835 836
         if (!is_object($document)) {
836  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  837
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
837 838
         }
838 839
 
839 840
         $this->errorIfClosed();
@@ -845,12 +846,12 @@ public function detach($document)
845 846
      *
846 847
      * @param object $document
847 848
      *
848  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  849
+     * @throws InvalidArgumentException if $document is not an object.
849 850
      */
850 851
     public function refresh($document)
851 852
     {
852 853
         if (!is_object($document)) {
853  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  854
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
854 855
         }
855 856
 
856 857
         $this->errorIfClosed();
@@ -872,12 +873,12 @@ public function refresh($document)
872 873
      *
873 874
      * @return ChildrenCollection collection of child documents
874 875
      *
875  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  876
+     * @throws InvalidArgumentException if $document is not an object.
876 877
      */
877 878
     public function getChildren($document, $filter = null, $fetchDepth = null, $locale = null)
878 879
     {
879 880
         if (!is_object($document)) {
880  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  881
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
881 882
         }
882 883
 
883 884
         $this->errorIfClosed();
@@ -908,12 +909,12 @@ public function getChildren($document, $filter = null, $fetchDepth = null, $loca
908 909
      *
909 910
      * @return ReferrersCollection collection of referrer documents
910 911
      *
911  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  912
+     * @throws InvalidArgumentException if $document is not an object.
912 913
      */
913 914
     public function getReferrers($document, $type = null, $name = null, $locale = null, $refClass = null)
914 915
     {
915 916
         if (!is_object($document)) {
916  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  917
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
917 918
         }
918 919
 
919 920
         $this->errorIfClosed();
@@ -928,13 +929,13 @@ public function getReferrers($document, $type = null, $name = null, $locale = nu
928 929
      * @param object|array|null $document optionally limit to a specific
929 930
      *      document or an array of documents
930 931
      *
931  
-     * @throws PHPCRInvalidArgumentException if $document is neither null nor a
  932
+     * @throws InvalidArgumentException if $document is neither null nor a
932 933
      *      document or an array of documents
933 934
      */
934 935
     public function flush($document = null)
935 936
     {
936 937
         if (null !== $document && !is_object($document) && !is_array($document)) {
937  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  938
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
938 939
         }
939 940
 
940 941
         $this->errorIfClosed();
@@ -972,12 +973,12 @@ public function getReference($documentName, $id)
972 973
      *
973 974
      * @param object $document
974 975
      *
975  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  976
+     * @throws InvalidArgumentException if $document is not an object.
976 977
      */
977 978
     public function checkin($document)
978 979
     {
979 980
         if (!is_object($document)) {
980  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  981
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
981 982
         }
982 983
 
983 984
         $this->errorIfClosed();
@@ -989,12 +990,12 @@ public function checkin($document)
989 990
      *
990 991
      * @param object $document
991 992
      *
992  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  993
+     * @throws InvalidArgumentException if $document is not an object.
993 994
      */
994 995
     public function checkout($document)
995 996
     {
996 997
         if (!is_object($document)) {
997  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  998
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
998 999
         }
999 1000
 
1000 1001
         $this->errorIfClosed();
@@ -1008,12 +1009,12 @@ public function checkout($document)
1008 1009
      *
1009 1010
      * @param object $document The document
1010 1011
      *
1011  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  1012
+     * @throws InvalidArgumentException if $document is not an object.
1012 1013
      */
1013 1014
     public function checkpoint($document)
1014 1015
     {
1015 1016
         if (!is_object($document)) {
1016  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  1017
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
1017 1018
         }
1018 1019
 
1019 1020
         $this->errorIfClosed();
@@ -1068,12 +1069,12 @@ public function removeVersion($documentVersion)
1068 1069
      * @return array of <versionname> => array("name" => <versionname>, "labels" => <array of labels>, "created" => <DateTime>)
1069 1070
      *         oldest version first
1070 1071
      *
1071  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  1072
+     * @throws InvalidArgumentException if $document is not an object.
1072 1073
      */
1073 1074
     public function getAllLinearVersions($document, $limit = -1)
1074 1075
     {
1075 1076
         if (!is_object($document)) {
1076  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  1077
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
1077 1078
         }
1078 1079
 
1079 1080
         $this->errorIfClosed();
@@ -1094,7 +1095,7 @@ public function getAllLinearVersions($document, $limit = -1)
1094 1095
      *
1095 1096
      * @return object the detached document or null if the document is not found
1096 1097
      *
1097  
-     * @throws PHPCRInvalidArgumentException if there is a document with $id but no
  1098
+     * @throws InvalidArgumentException if there is a document with $id but no
1098 1099
      *      version with $name
1099 1100
      * @throws \PHPCR\UnsupportedRepositoryOperationException if the implementation
1100 1101
      *      does not support versioning
@@ -1113,12 +1114,12 @@ public function findVersionByName($className, $id, $versionName)
1113 1114
      *
1114 1115
      * @return boolean true if the repository contains the object, false otherwise
1115 1116
      *
1116  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  1117
+     * @throws InvalidArgumentException if $document is not an object.
1117 1118
      */
1118 1119
     public function contains($document)
1119 1120
     {
1120 1121
         if (!is_object($document)) {
1121  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  1122
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
1122 1123
         }
1123 1124
 
1124 1125
         return $this->unitOfWork->contains($document);
@@ -1170,12 +1171,12 @@ public function close()
1170 1171
      *
1171 1172
      * @param object $document
1172 1173
      *
1173  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  1174
+     * @throws InvalidArgumentException if $document is not an object.
1174 1175
      */
1175 1176
     public function initializeObject($document)
1176 1177
     {
1177 1178
         if (!is_object($document)) {
1178  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  1179
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
1179 1180
         }
1180 1181
 
1181 1182
         $this->unitOfWork->initializeObject($document);
@@ -1188,13 +1189,13 @@ public function initializeObject($document)
1188 1189
      *
1189 1190
      * @return \PHPCR\NodeInterface
1190 1191
      *
1191  
-     * @throws PHPCRInvalidArgumentException if $document is not an object.
  1192
+     * @throws InvalidArgumentException if $document is not an object.
1192 1193
      * @throws PHPCRException                if $document is not managed
1193 1194
      */
1194 1195
     public function getNodeForDocument($document)
1195 1196
     {
1196 1197
         if (!is_object($document)) {
1197  
-            throw new PHPCRInvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
  1198
+            throw new InvalidArgumentException('Parameter $document needs to be an object, '.gettype($document).' given');
1198 1199
         }
1199 1200
 
1200 1201
         $path = $this->unitOfWork->getDocumentId($document);
4  lib/Doctrine/ODM/PHPCR/DocumentRepository.php
@@ -24,7 +24,7 @@
24 24
 use Doctrine\ODM\PHPCR\Query\Query;
25 25
 
26 26
 use PHPCR\Query\QOM\QueryObjectModelConstantsInterface as Constants;
27  
-use Doctrine\ODM\PHPCR\PHPCRInvalidArgumentException;
  27
+use Doctrine\ODM\PHPCR\Exception\InvalidArgumentException;
28 28
 
29 29
 /**
30 30
  * A DocumentRepository serves as a repository for documents with generic as well as
@@ -147,7 +147,7 @@ public function findBy(array $criteria, array $orderBy = null, $limit = null, $o
147 147
             foreach ($orderBy as $field => $order) {
148 148
                 $order = strtolower($order);
149 149
                 if (!in_array($order, array('asc', 'desc'))) {
150  
-                    throw new PHPCRInvalidArgumentException(sprintf(
  150
+                    throw new InvalidArgumentException(sprintf(
151 151
                         'Invalid order specified by order, expected either "asc" or "desc", got "%s"',
152 152
                         $order
153 153
                     ));
10  lib/Doctrine/ODM/PHPCR/PHPCRRuntimeException.php → ...ne/ODM/PHPCR/Exception/BadMethodCallException.php
@@ -17,15 +17,13 @@
17 17
  * <http://www.doctrine-project.org>.
18 18
  */
19 19
 
20  
-namespace Doctrine\ODM\PHPCR;
  20
+namespace Doctrine\ODM\PHPCR\Exception;
  21
+
  22
+use Doctrine\ODM\PHPCR\PHPCRExceptionInterface;
21 23
 
22 24
 /**
23 25
  * InvalidArgumentException for the PHPCR-ODM
24  
- *
25  
- * @license     http://www.opensource.org/licenses/MIT-license.php MIT license
26  
- * @link        www.doctrine-project.com
27  
- * @since       1.0
28 26
  */
29  
-class PHPCRRuntimeException extends PHPCRException
  27
+class BadMethodCallException extends \BadMethodCallException implements PHPCRExceptionInterface
30 28
 {
31 29
 }
5  lib/Doctrine/ODM/PHPCR/Exception/CascadeException.php
@@ -24,10 +24,7 @@
24 24
 /**
25 25
  * Missing translation exception class
26 26
  *
27  
- * @license     http://www.opensource.org/licenses/MIT-license.php MIT license
28  
- * @link        www.doctrine-project.com
29  
- * @since       1.0
30  
- * @author      Lukas Kahwe Smith <smith@pooteeweet.org>
  27
+ * @author Lukas Kahwe Smith <smith@pooteeweet.org>
31 28
  */
32 29
 class CascadeException extends PHPCRException
33 30
 {
10  ...trine/ODM/PHPCR/PHPCRInvalidArgumentException.php → .../ODM/PHPCR/Exception/InvalidArgumentException.php
@@ -17,15 +17,13 @@
17 17
  * <http://www.doctrine-project.org>.
18 18
  */
19 19
 
20  
-namespace Doctrine\ODM\PHPCR;
  20
+namespace Doctrine\ODM\PHPCR\Exception;
  21
+
  22
+use Doctrine\ODM\PHPCR\PHPCRExceptionInterface;
21 23
 
22 24
 /**
23 25
  * InvalidArgumentException for the PHPCR-ODM
24  
- *
25  
- * @license     http://www.opensource.org/licenses/MIT-license.php MIT license
26  
- * @link        www.doctrine-project.com
27  
- * @since       1.0
28 26
  */
29  
-class PHPCRInvalidArgumentException extends PHPCRException
  27
+class InvalidArgumentException extends \InvalidArgumentException implements PHPCRExceptionInterface
30 28
 {
31 29
 }
34  lib/Doctrine/ODM/PHPCR/Exception/MissingTranslationException.php
... ...
@@ -1,34 +0,0 @@
1  
-<?php
2  
-    /*
3  
-     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4  
-     * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5  
-     * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6  
-     * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7  
-     * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8  
-     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9  
-     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10  
-     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11  
-     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12  
-     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13  
-     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14  
-     *
15  
-     * This software consists of voluntary contributions made by many individuals
16  
-     * and is licensed under the MIT license. For more information, see
17  
-     * <http://www.doctrine-project.org>.
18  
-     */
19  
-
20  
-namespace Doctrine\ODM\PHPCR\Exception;
21  
-
22  
-use Doctrine\ODM\PHPCR\PHPCRException;
23  
-
24  
-/**
25  
- * Missing translation exception class
26  
- *
27  
- * @license     http://www.opensource.org/licenses/MIT-license.php MIT license
28  
- * @link        www.doctrine-project.com
29  
- * @since       1.0
30  
- * @author      Lukas Kahwe Smith <smith@pooteeweet.org>
31  
- */
32  
-class MissingTranslationException extends PHPCRException
33  
-{
34  
-}
29  lib/Doctrine/ODM/PHPCR/Exception/OutOfBoundsException.php
... ...
@@ -0,0 +1,29 @@
  1
+<?php
  2
+/*
  3
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14
+ *
  15
+ * This software consists of voluntary contributions made by many individuals
  16
+ * and is licensed under the MIT license. For more information, see
  17
+ * <http://www.doctrine-project.org>.
  18
+ */
  19
+
  20
+namespace Doctrine\ODM\PHPCR\Exception;
  21
+
  22
+use Doctrine\ODM\PHPCR\PHPCRExceptionInterface;
  23
+
  24
+/**
  25
+ * InvalidArgumentException for the PHPCR-ODM
  26
+ */
  27
+class OutOfBoundsException extends \OutOfBoundsException implements PHPCRExceptionInterface
  28
+{
  29
+}
29  lib/Doctrine/ODM/PHPCR/Exception/RuntimeException.php
... ...
@@ -0,0 +1,29 @@
  1
+<?php
  2
+/*
  3
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14
+ *
  15
+ * This software consists of voluntary contributions made by many individuals
  16
+ * and is licensed under the MIT license. For more information, see
  17
+ * <http://www.doctrine-project.org>.
  18
+ */
  19
+
  20
+namespace Doctrine\ODM\PHPCR\Exception;
  21
+
  22
+use Doctrine\ODM\PHPCR\PHPCRExceptionInterface;
  23
+
  24
+/**
  25
+ * InvalidArgumentException for the PHPCR-ODM
  26
+ */
  27
+class RuntimeException extends \RuntimeException implements PHPCRExceptionInterface
  28
+{
  29
+}
2  lib/Doctrine/ODM/PHPCR/Id/AssignedIdGenerator.php
@@ -20,8 +20,8 @@
20 20
 namespace Doctrine\ODM\PHPCR\Id;
21 21
 
22 22
 use Doctrine\ODM\PHPCR\DocumentManager;
23  
-use Doctrine\ODM\PHPCR\Mapping\ClassMetadata;
24 23
 use Doctrine\ODM\PHPCR\PHPCRException;
  24
+use Doctrine\ODM\PHPCR\Mapping\ClassMetadata;
25 25
 
26 26
 /**
27 27
  * Generator to handle explicitly assigned repository paths.
4  lib/Doctrine/ODM/PHPCR/Id/IdGenerator.php
@@ -21,7 +21,7 @@
21 21
 
22 22
 use Doctrine\ODM\PHPCR\DocumentManager;
23 23
 use Doctrine\ODM\PHPCR\Mapping\ClassMetadata;
24  
-use Doctrine\ODM\PHPCR\PHPCRInvalidArgumentException;
  24
+use Doctrine\ODM\PHPCR\Exception\InvalidArgumentException;
25 25
 
26 26
 /**
27 27
  * Used to abstract ID generation
@@ -58,7 +58,7 @@ public static function create($generatorType)
58 58
                 break;
59 59
 
60 60
             default:
61  
-                throw new PHPCRInvalidArgumentException("ID Generator does not exist: $generatorType");
  61
+                throw new InvalidArgumentException("ID Generator does not exist: $generatorType");
62 62
         }
63 63
 
64 64
         return $instance;
5  lib/Doctrine/ODM/PHPCR/Id/RepositoryIdGenerator.php
@@ -21,7 +21,6 @@
21 21
 
22 22
 use Doctrine\ODM\PHPCR\DocumentManager;
23 23
 use Doctrine\ODM\PHPCR\Mapping\ClassMetadata;
24  
-use Doctrine\ODM\PHPCR\PHPCRException;
25 24
 
26 25
 class RepositoryIdGenerator extends IdGenerator
27 26
 {
@@ -37,12 +36,12 @@ public function generate($document, ClassMetadata $class, DocumentManager $dm, $
37 36
         }
38 37
         $repository = $dm->getRepository($class->name);
39 38
         if (!($repository instanceof RepositoryIdInterface)) {
40  
-            throw new PHPCRException("ID could not be determined. Make sure the that the Repository '".get_class($repository)."' implements RepositoryIdInterface");
  39
+            throw new IdException("ID could not be determined. Make sure the that the Repository '".get_class($repository)."' implements RepositoryIdInterface");
41 40
         }
42 41
 
43 42
         $id = $repository->generateId($document, $parent);
44 43
         if (!$id) {
45  
-            throw new PHPCRException("ID could not be determined. Repository was unable to generate an ID");
  44
+            throw new IdException("ID could not be determined. Repository was unable to generate an ID");
46 45
         }
47 46
 
48 47
         return $id;
5  lib/Doctrine/ODM/PHPCR/Mapping/ClassMetadata.php
@@ -19,6 +19,7 @@
19 19
 
20 20
 namespace Doctrine\ODM\PHPCR\Mapping;
21 21
 
  22
+use Doctrine\ODM\PHPCR\Exception\BadMethodCallException;
22 23
 use Doctrine\ODM\PHPCR\Mapping\MappingException;
23 24
 use Doctrine\ODM\PHPCR\Event;
24 25
 use ReflectionProperty;
@@ -1203,7 +1204,7 @@ public function getAssociationTargetClass($fieldName)
1203 1204
      */
1204 1205
     public function getAssociationMappedByTargetField($assocName)
1205 1206
     {
1206  
-        throw new \BadMethodCallException(__METHOD__."  not yet implemented in '{$this->name}'");
  1207
+        throw new BadMethodCallException(__METHOD__."  not yet implemented in '{$this->name}'");
1207 1208
     }
1208 1209
 
1209 1210
     /**
@@ -1211,7 +1212,7 @@ public function getAssociationMappedByTargetField($assocName)
1211 1212
      */
1212 1213
     public function isAssociationInverseSide($assocName)
1213 1214
     {
1214  
-        throw new \BadMethodCallException(__METHOD__."  not yet implemented in '{$this->name}'");
  1215
+        throw new BadMethodCallException(__METHOD__."  not yet implemented in '{$this->name}'");
1215 1216
     }
1216 1217
 
1217 1218
     /**
3  lib/Doctrine/ODM/PHPCR/Mapping/MappingException.php
@@ -20,6 +20,7 @@
20 20
 namespace Doctrine\ODM\PHPCR\Mapping;
21 21
 
22 22
 use Doctrine\Common\Persistence\Mapping\MappingException as BaseMappingException;
  23
+use Doctrine\ODM\PHPCR\PHPCRExceptionInterface;
23 24
 
24 25
 /**
25 26
  * Mapping exception class
@@ -30,7 +31,7 @@
30 31
  * @author      Benjamin Eberlei <kontakt@beberlei.de>
31 32
  * @author      Lukas Kahwe Smith <smith@pooteeweet.org>
32 33
  */
33  
-class MappingException extends BaseMappingException
  34
+class MappingException extends BaseMappingException implements PHPCRExceptionInterface
34 35
 {
35 36
     public static function classNotFound($className)
36 37
     {
8  lib/Doctrine/ODM/PHPCR/PHPCRException.php
@@ -20,13 +20,9 @@
20 20
 namespace Doctrine\ODM\PHPCR;
21 21
 
22 22
 /**
23  
- * Base exception class for package Doctrine\ODM\PHPCR
24  
- *
25  
- * @license     http://www.opensource.org/licenses/MIT-license.php MIT license
26  
- * @link        www.doctrine-project.com
27  
- * @since       1.0
  23
+ * Basic exception class for Doctrine PHPCR-ODM.
28 24
  */
29  
-class PHPCRException extends \Exception
  25
+class PHPCRException extends \Exception implements PHPCRExceptionInterface
30 26
 {
31 27
     public static function unknownDocumentNamespace($documentNamespaceAlias)
32 28
     {
27  lib/Doctrine/ODM/PHPCR/PHPCRExceptionInterface.php
... ...
@@ -0,0 +1,27 @@
  1
+<?php
  2
+/*
  3
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14
+ *
  15
+ * This software consists of voluntary contributions made by many individuals
  16
+ * and is licensed under the MIT license. For more information, see
  17
+ * <http://www.doctrine-project.org>.
  18
+ */
  19
+
  20
+namespace Doctrine\ODM\PHPCR;
  21
+
  22
+/**
  23
+ * Marker interface that all Doctrine PHPCR-ODM exceptions implement.
  24
+ */
  25
+interface PHPCRExceptionInterface
  26
+{
  27
+}
7  lib/Doctrine/ODM/PHPCR/Query/Builder/AbstractLeafNode.php
@@ -2,6 +2,7 @@
2 2
 
3 3
 namespace Doctrine\ODM\PHPCR\Query\Builder;
4 4
 
  5
+use Doctrine\ODM\PHPCR\Exception\RuntimeException;
5 6
 use Doctrine\ODM\PHPCR\Query\Builder\AbstractNode;
6 7
 
7 8
 /**
@@ -19,7 +20,7 @@ public function getNext()
19 20
 
20 21
     public function getChildren()
21 22
     {
22  
-        throw new \RuntimeException(sprintf(
  23
+        throw new RuntimeException(sprintf(
23 24
             'Cannot call getChildren on leaf node "%s"',
24 25
             $this->getName()
25 26
         ));
@@ -27,7 +28,7 @@ public function getChildren()
27 28
 
28 29
     public function addChild(AbstractNode $node)
29 30
     {
30  
-        throw new \RuntimeException(sprintf(
  31
+        throw new RuntimeException(sprintf(
31 32
             'Cannot call addChild to leaf node "%s"',
32 33
             $this->getName()
33 34
         ));
@@ -59,7 +60,7 @@ protected function explodeField($field)
59 60
             return $parts;
60 61
         }
61 62
 
62  
-        throw new \RuntimeException(sprintf(
  63
+        throw new RuntimeException(sprintf(
63 64
             'Invalid field specification, '.
64 65
             'expected string like "[alias].[field_name]", got "%s"',
65 66
             $field
43  lib/Doctrine/ODM/PHPCR/Query/Builder/AbstractNode.php
... ...
@@ -1,6 +1,9 @@
1 1
 <?php
2 2
 
3 3
 namespace Doctrine\ODM\PHPCR\Query\Builder;
  4
+use Doctrine\ODM\PHPCR\Exception\BadMethodCallException;
  5
+use Doctrine\ODM\PHPCR\Exception\InvalidArgumentException;
  6
+use Doctrine\ODM\PHPCR\Exception\OutOfBoundsException;
4 7
 
5 8
 /**
6 9
  * All QueryBuilder nodes extend this class.
@@ -126,10 +129,10 @@ public function setChild(AbstractNode $node)
126 129
      * permitted number of nodes would be exceeded by adding
127 130
      * the given child node.
128 131
      *
129  
-     * The given node will be returned EXCEPT when the current 
  132
+     * The given node will be returned EXCEPT when the current
130 133
      * node is a leaf node, in which case we return the parent.
131 134
      *
132  
-     * @throws \OutOfBoundsException
  135
+     * @throws OutOfBoundsException
133 136
      *
134 137
      * @return AbstractNode
135 138
      */
@@ -143,7 +146,7 @@ public function addChild(AbstractNode $node)
143 146
 
144 147
         // if proposed child node is of an invalid type
145 148
         if (!isset($cardinalityMap[$nodeType])) {
146  
-            throw new \OutOfBoundsException(sprintf(
  149
+            throw new OutOfBoundsException(sprintf(
147 150
                 'QueryBuilder node "%s" of type "%s" cannot be appended to "%s". '.
148 151
                 'Must be one type of "%s"',
149 152
                 $node->getName(),
@@ -153,14 +156,14 @@ public function addChild(AbstractNode $node)
153 156
             ));
154 157
         }
155 158
 
156  
-        $currentCardinality = isset($this->children[$node->getName()]) ? 
  159
+        $currentCardinality = isset($this->children[$node->getName()]) ?
157 160
             count($this->children[$node->getName()]) : 0;
158 161
 
159 162
         list($min, $max) = $cardinalityMap[$nodeType];
160 163
 
161 164
         // if bounded and cardinality will exceed max
162 165
         if (null !== $max && $currentCardinality + 1 > $max) {
163  
-            throw new \OutOfBoundsException(sprintf(
  166
+            throw new OutOfBoundsException(sprintf(
164 167
                 'QueryBuilder node "%s" cannot be appended to "%s". '.
165 168
                 'Number of "%s" nodes cannot exceed "%s"',
166 169
                 $node->getName(),
@@ -212,7 +215,7 @@ public function getChildren()
212 215
      *
213 216
      * @return array AbstractNode[]
214 217
      */
215  
-    public function getChildrenOfType($type) 
  218
+    public function getChildrenOfType($type)
216 219
     {
217 220
         if (!isset($this->children[$type])) {
218 221
             return array();
@@ -229,22 +232,22 @@ public function removeChildrenOfType($type)
229 232
     /**
230 233
      * Return child of node, there must be exactly one child of any type.
231 234
      *
232  
-     * @throws \OutOfBoundsException if there are more than one or none
  235
+     * @throws OutOfBoundsException if there are more than one or none
233 236
      * @return array AbstractNode[]
234 237
      */
235  
-    public function getChild() 
  238
+    public function getChild()
236 239
     {
237 240
         $children = $this->getChildren();
238 241
 
239 242
         if (!$children) {
240  
-            throw new \OutOfBoundsException(sprintf(
  243
+            throw new OutOfBoundsException(sprintf(
241 244
                 'Expected exactly one child, got "%s"',
242 245
                 count($children)
243 246
             ));
244 247
         }
245 248
 
246 249
         if (count($children) > 1) {
247  
-            throw new \OutOfBoundsException(sprintf(
  250
+            throw new OutOfBoundsException(sprintf(
248 251
                 'More than one child node but getChild will only ever return one. "%d" returned.',
249 252
                 count($children)
250 253
             ));
@@ -257,23 +260,23 @@ public function getChild()
257 260
      * Return child of specified type.
258 261
      *
259 262
      * Note: This does not take inheritance into account.
260  
-     * 
261  
-     * @throws \OutOfBoundsException if there are more than one or none
  263
+     *
  264
+     * @throws OutOfBoundsException if there are more than one or none
262 265
      * @return array AbstractNode[]
263 266
      */
264  
-    public function getChildOfType($type) 
  267
+    public function getChildOfType($type)
265 268
     {
266 269
         $children = $this->getChildrenOfType($type);
267 270
 
268 271
         if (!$children) {
269  
-            throw new \OutOfBoundsException(sprintf(
  272
+            throw new OutOfBoundsException(sprintf(
270 273
                 'Expected exactly one child of type "%s", got "%s"',
271 274
                 $type, count($children)
272 275
             ));
273 276
         }
274 277
 
275 278
         if (count($children) > 1) {
276  
-            throw new \OutOfBoundsException(sprintf(
  279
+            throw new OutOfBoundsException(sprintf(
277 280
                 'More than one node of type "%s" but getChildOfType will only ever return one.',
278 281
                 $type
279 282
             ));
@@ -292,7 +295,7 @@ public function getChildOfType($type)
292 295
      * the addChild() method already validates maximum boundries and
293 296
      * types.
294 297
      *
295  
-     * @throws \OutOfBoundsException
  298
+     * @throws OutOfBoundsException
296 299
      * @return void
297 300
      */
298 301
     public function validate()
@@ -311,7 +314,7 @@ public function validate()
311 314
         foreach ($typeCount as $type => $count) {
312 315
             list($min, $max) = $cardinalityMap[$type];
313 316
             if (null !== $min && $count < $min) {
314  
-                throw new \OutOfBoundsException(sprintf(
  317
+                throw new OutOfBoundsException(sprintf(
315 318
                     'QueryBuilder node "%s" must have at least "%s" '.
316 319
                     'child nodes of type "%s". "%s" given.',
317 320
                     $this->getName(),
@@ -340,11 +343,11 @@ public function end()
340 343
      * Catch any undefined method calls and tell the developer what
341 344
      * methods can be called.
342 345
      *
343  
-     * @throws \RuntimeException
  346
+     * @throws BadMethodCallException if an unknown method is called.
344 347
      */
345 348
     public function __call($methodName, $args)
346 349
     {
347  
-        throw new \BadMethodCallException(sprintf(
  350
+        throw new BadMethodCallException(sprintf(
348 351
             'Unknown method "%s" called on node "%s", did you mean one of: "%s"',
349 352
             $methodName,
350 353
             $this->getName(),
@@ -355,7 +358,7 @@ public function __call($methodName, $args)
355 358
     public function ensureNoArguments($method, $void)
356 359
     {
357 360
         if ($void) {
358  
-            throw new \Exception(sprintf(
  361
+            throw new InvalidArgumentException(sprintf(
359 362
                 'Method "%s" is a factory method and accepts no arguments',
360 363
                 $method
361 364
             ));
17  lib/Doctrine/ODM/PHPCR/Query/Builder/BuilderConverterPhpcr.php
@@ -2,13 +2,14 @@
2 2
 
3 3
 namespace Doctrine\ODM\PHPCR\Query\Builder;
4 4
 
  5
+use Doctrine\ODM\PHPCR\Exception\RuntimeException;
5 6
 use PHPCR\Query\QOM\QueryObjectModelFactoryInterface;
6 7
 use Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory;
7 8
 use PHPCR\Query\QOM\QueryObjectModelConstantsInterface as QOMConstants;
8 9
 use Doctrine\ODM\PHPCR\Query\Query;
9 10
 use Doctrine\ODM\PHPCR\DocumentManager;