. */ #namespace Doctrine::ORM::Internal; /** * The code metadata driver loads the metadata of the classes through invoking * a static callback method that needs to be implemented when using this driver. * * @author Konsta Vesterinen * @author Roman Borschel * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @version $Revision$ * @link www.phpdoctrine.org * @since 2.0 */ class Doctrine_ClassMetadata_CodeDriver { /** * Name of the callback method. * * @todo We could make the name of the callback methods customizable for users. */ const CALLBACK_METHOD = 'initMetadata'; /** * Loads the metadata for the specified class into the provided container. */ public function loadMetadataForClass($className, Doctrine_ClassMetadata $metadata) { if ( ! method_exists($className, self::CALLBACK_METHOD)) { throw new Doctrine_ClassMetadata_Exception("Unable to load metadata for class" . " '$className'. Callback method 'initMetadata' not found."); } call_user_func_array(array($className, 'initMetadata'), array($metadata)); } }