Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Created December 13, 2015 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doctrinebot/0009211af4aa695c99ce to your computer and use it in GitHub Desktop.
Save doctrinebot/0009211af4aa695c99ce to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-1412 - https://github.com/doctrine/doctrine2/issues/2036
### Eclipse Workspace Patch 1.0
#P LeezyServer
Index: libraries/Doctrine/ORM/Mapping/Driver/DriverChain.php
===================================================================
--- libraries/Doctrine/ORM/Mapping/Driver/DriverChain.php (revision 6863)
+++ libraries/Doctrine/ORM/Mapping/Driver/DriverChain.php (working copy)
@@ -40,6 +40,12 @@
* @var array
*/
private $_drivers = array();
+
+ /**
+ * @var Driver
+ * @author armetiz
+ */
+ private $_defaultDriver = null;
/**
* Add a nested driver.
@@ -53,6 +59,28 @@
}
/**
+ * Set a default driver.
+ *
+ * @param Driver $defaultDriver
+ * @author armetiz
+ */
+ public function setDefaultDriver(Driver $defaultDriver)
+ {
+ $this->_defaultDriver = $defaultDriver;
+ }
+
+ /**
+ * Set a default driver.
+ *
+ * @return Driver
+ * @author armetiz
+ */
+ public function getDefaultDriver()
+ {
+ return $this->_defaultDriver;
+ }
+
+ /**
* Get the array of nested drivers.
*
* @return array $drivers
@@ -76,8 +104,11 @@
return;
}
}
+
+ if ( is_null ( $this->_defaultDriver ) )
+ throw MappingException::classIsNotAValidEntityOrMappedSuperClass($className);
- throw MappingException::classIsNotAValidEntityOrMappedSuperClass($className);
+ $this->_defaultDriver->loadMetadataForClass($className, $metadata);
}
/**
@@ -119,8 +150,11 @@
return $driver->isTransient($className);
}
}
-
+
// class isTransient, i.e. not an entity or mapped superclass
- return true;
+ if ( is_null ( $this->_defaultDriver ) )
+ return true;
+
+ return $this->_defaultDriver->isTransient($className);
}
}
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment