CodeDriver.php 798 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?php 

/**
 * 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 Roman Borschel <roman@code-factory.org>
 */
class Doctrine_ClassMetadata_CodeDriver
{
    /**
     * Loads the metadata for the specified class into the provided container.
     */
    public function loadMetadataForClass($className, Doctrine_ClassMetadata $metadata)
    {
16 17 18 19
        if ( ! method_exists($className, 'initMetadata')) {
            throw new Doctrine_ClassMetadata_Exception("Unable to load metadata for class"
                    . " '$className'. Callback method 'initMetadata' not found.");
        }
20 21 22
        call_user_func_array(array($className, 'initMetadata'), array($metadata));
    }   
}