vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/PHPDriver.php
changeset 0 7f95f8617b0b
equal deleted inserted replaced
-1:000000000000 0:7f95f8617b0b
       
     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 LGPL. For more information, see
       
    17  * <http://www.doctrine-project.org>.
       
    18  */
       
    19 
       
    20 namespace Doctrine\ORM\Mapping\Driver;
       
    21 
       
    22 use Doctrine\Common\Cache\ArrayCache,
       
    23     Doctrine\Common\Annotations\AnnotationReader,
       
    24     Doctrine\DBAL\Schema\AbstractSchemaManager,
       
    25     Doctrine\ORM\Mapping\ClassMetadataInfo,
       
    26     Doctrine\ORM\Mapping\MappingException,
       
    27     Doctrine\Common\Util\Inflector,
       
    28     Doctrine\ORM\Mapping\Driver\AbstractFileDriver;
       
    29 
       
    30 /**
       
    31  * The PHPDriver includes php files which just populate ClassMetadataInfo
       
    32  * instances with plain php code
       
    33  *
       
    34  * @license 	http://www.opensource.org/licenses/lgpl-license.php LGPL
       
    35  * @link    	www.doctrine-project.org
       
    36  * @since   	2.0
       
    37  * @version     $Revision$
       
    38  * @author		Benjamin Eberlei <kontakt@beberlei.de>
       
    39  * @author		Guilherme Blanco <guilhermeblanco@hotmail.com>
       
    40  * @author      Jonathan H. Wage <jonwage@gmail.com>
       
    41  * @author      Roman Borschel <roman@code-factory.org>
       
    42  * @todo Rename: PHPDriver
       
    43  */
       
    44 class PHPDriver extends AbstractFileDriver
       
    45 {
       
    46     /**
       
    47      * {@inheritdoc}
       
    48      */
       
    49     protected $_fileExtension = '.php';
       
    50     protected $_metadata;
       
    51 
       
    52     /**
       
    53      * {@inheritdoc}
       
    54      */
       
    55     public function loadMetadataForClass($className, ClassMetadataInfo $metadata)
       
    56     {
       
    57         $this->_metadata = $metadata;
       
    58         $this->_loadMappingFile($this->_findMappingFile($className));
       
    59     }
       
    60 
       
    61     /**
       
    62      * {@inheritdoc}
       
    63      */
       
    64     protected function _loadMappingFile($file)
       
    65     {
       
    66         $metadata = $this->_metadata;
       
    67         include $file;
       
    68     }
       
    69 }