1
0
mirror of synced 2025-01-31 12:32:59 +03:00

Merge remote branch 'dc2master/master'

This commit is contained in:
Benjamin Eberlei 2010-05-01 03:12:27 +02:00
commit 9cee8bf890
11 changed files with 42 additions and 32 deletions

View File

@ -142,16 +142,16 @@
<nativephpunit testfile="./tests/Doctrine/Tests/ORM/Performance/AllTests.php" testdirectory="./tests" haltonfailure="false" haltonerror="false" /> <nativephpunit testfile="./tests/Doctrine/Tests/ORM/Performance/AllTests.php" testdirectory="./tests" haltonfailure="false" haltonerror="false" />
<tstamp/> <tstamp/>
<svnlastrevision svnpath="${svn.path}" workingcopy="." propertyname="svn.lastrevision"/> <!--<svnlastrevision svnpath="${svn.path}" workingcopy="." propertyname="svn.lastrevision"/>-->
<copy file="${build.dir}/logs/testsuites.xml" tofile="${log.archive.dir}/${svn.lastrevision}/log.xml" overwrite="true"/> <copy file="${build.dir}/logs/testsuites.xml" tofile="${log.archive.dir}/latest/log.xml" overwrite="true"/>
<if><equals arg1="${test.pmd_reports}" arg2="1" /> <if><equals arg1="${test.pmd_reports}" arg2="1" />
<then> <then>
<exec command="${test.pdepend_exec} --jdepend-xml=${build.dir}/logs/jdepend.xml ./lib/Doctrine" /> <exec command="${test.pdepend_exec} --jdepend-xml=${build.dir}/logs/jdepend.xml ./lib/Doctrine" />
<exec command="${test.phpmd_exec} ./lib/Doctrine xml codesize --reportfile ${build.dir}/logs/phpmd.xml" /> <exec command="${test.phpmd_exec} ./lib/Doctrine xml codesize --reportfile ${build.dir}/logs/phpmd.xml" />
<copy file="${build.dir}/logs/jdepend.xml" tofile="${log.archive.dir}/${svn.lastrevision}/jdepend.xml" overwrite="true"/> <copy file="${build.dir}/logs/jdepend.xml" tofile="${log.archive.dir}/latest/jdepend.xml" overwrite="true"/>
<copy file="${build.dir}/logs/phpmd.xml" tofile="${log.archive.dir}/${svn.lastrevision}/phpmd.xml" overwrite="true"/> <copy file="${build.dir}/logs/phpmd.xml" tofile="${log.archive.dir}/latest/phpmd.xml" overwrite="true"/>
</then> </then>
</if> </if>
</target> </target>
@ -163,7 +163,7 @@
<d51pearpkg2 baseinstalldir="/" dir="${build.dir}/common/DoctrineCommon-${version}"> <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/common/DoctrineCommon-${version}">
<name>DoctrineCommon</name> <name>DoctrineCommon</name>
<summary>Common Doctrine code</summary> <summary>Common Doctrine code</summary>
<channel>pear.phpdoctrine.org</channel> <channel>pear.doctrine-project.org</channel>
<description>The Doctrine Common package contains shared code between the other packages.</description> <description>The Doctrine Common package contains shared code between the other packages.</description>
<lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" /> <lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
<lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" /> <lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" />
@ -182,7 +182,7 @@
<d51pearpkg2 baseinstalldir="/" dir="${build.dir}/dbal/DoctrineDBAL-${version}"> <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/dbal/DoctrineDBAL-${version}">
<name>DoctrineDBAL</name> <name>DoctrineDBAL</name>
<summary>Doctrine Database Abstraction Layer</summary> <summary>Doctrine Database Abstraction Layer</summary>
<channel>pear.phpdoctrine.org</channel> <channel>pear.doctrine-project.org</channel>
<description>The Doctrine DBAL package is the database abstraction layer used to power the ORM package.</description> <description>The Doctrine DBAL package is the database abstraction layer used to power the ORM package.</description>
<lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" /> <lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
<lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" /> <lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" />
@ -201,7 +201,7 @@
<d51pearpkg2 baseinstalldir="/" dir="${build.dir}/orm/DoctrineORM-${version}"> <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/orm/DoctrineORM-${version}">
<name>DoctrineORM</name> <name>DoctrineORM</name>
<summary>Doctrine Object Relationl Mapper</summary> <summary>Doctrine Object Relationl Mapper</summary>
<channel>pear.phpdoctrine.org</channel> <channel>pear.doctrine-project.org</channel>
<description>The Doctrine ORM package is the primary package containing the object relational mapper.</description> <description>The Doctrine ORM package is the primary package containing the object relational mapper.</description>
<lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" /> <lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
<lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" /> <lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" />

View File

@ -60,6 +60,7 @@ class OCI8Statement implements \Doctrine\DBAL\Driver\Statement
* placeholders and converted to a named parameter. * placeholders and converted to a named parameter.
* *
* @param string $statement The SQL statement to convert. * @param string $statement The SQL statement to convert.
* @todo review and test for lost spaces. we experienced missing spaces with oci8 in some sql statements.
*/ */
private function _convertPositionalToNamedPlaceholders($statement) private function _convertPositionalToNamedPlaceholders($statement)
{ {

View File

@ -356,7 +356,8 @@ abstract class AssociationMapping
$serialized = array( $serialized = array(
'sourceEntityName', 'sourceEntityName',
'targetEntityName', 'targetEntityName',
'sourceFieldName' 'sourceFieldName',
'fetchMode'
); );
if ($this->isCascadeDetach) { if ($this->isCascadeDetach) {

View File

@ -41,13 +41,6 @@ use ReflectionClass, ReflectionProperty;
*/ */
class ClassMetadata extends ClassMetadataInfo class ClassMetadata extends ClassMetadataInfo
{ {
/**
* The ReflectionClass instance of the mapped class.
*
* @var ReflectionClass
*/
public $reflClass;
/** /**
* The ReflectionProperty instances of the mapped class. * The ReflectionProperty instances of the mapped class.
* *
@ -76,16 +69,6 @@ class ClassMetadata extends ClassMetadataInfo
$this->table['name'] = $this->reflClass->getShortName(); $this->table['name'] = $this->reflClass->getShortName();
} }
/**
* Gets the ReflectionClass instance of the mapped class.
*
* @return ReflectionClass
*/
public function getReflectionClass()
{
return $this->reflClass;
}
/** /**
* Gets the ReflectionPropertys of the mapped class. * Gets the ReflectionPropertys of the mapped class.
* *
@ -286,6 +269,7 @@ class ClassMetadata extends ClassMetadataInfo
'identifier', 'identifier',
'isIdentifierComposite', // TODO: REMOVE 'isIdentifierComposite', // TODO: REMOVE
'name', 'name',
'namespace', // TODO: REMOVE
'table', 'table',
'rootEntityName', 'rootEntityName',
'idGenerator', //TODO: Does not really need to be serialized. Could be moved to runtime. 'idGenerator', //TODO: Does not really need to be serialized. Could be moved to runtime.

View File

@ -19,6 +19,8 @@
namespace Doctrine\ORM\Mapping; namespace Doctrine\ORM\Mapping;
use ReflectionClass;
/** /**
* A <tt>ClassMetadata</tt> instance holds all the object-relational mapping metadata * A <tt>ClassMetadata</tt> instance holds all the object-relational mapping metadata
* of an entity and it's associations. * of an entity and it's associations.
@ -366,6 +368,13 @@ class ClassMetadataInfo
*/ */
public $versionField; public $versionField;
/**
* The ReflectionClass instance of the mapped class.
*
* @var ReflectionClass
*/
public $reflClass;
/** /**
* Initializes a new ClassMetadata instance that will hold the object-relational mapping * Initializes a new ClassMetadata instance that will hold the object-relational mapping
* metadata of the class with the given name. * metadata of the class with the given name.
@ -378,6 +387,19 @@ class ClassMetadataInfo
$this->rootEntityName = $entityName; $this->rootEntityName = $entityName;
} }
/**
* Gets the ReflectionClass instance of the mapped class.
*
* @return ReflectionClass
*/
public function getReflectionClass()
{
if ( ! $this->reflClass) {
$this->reflClass = new ReflectionClass($entityName);
}
return $this->reflClass;
}
/** /**
* Sets the change tracking policy used by this class. * Sets the change tracking policy used by this class.
* *

View File

@ -143,7 +143,7 @@ class AnnotationDriver implements Driver
throw MappingException::classIsNotAValidEntityOrMappedSuperClass($className); throw MappingException::classIsNotAValidEntityOrMappedSuperClass($className);
} }
// Evaluate DoctrineTable annotation // Evaluate Table annotation
if (isset($classAnnotations['Doctrine\ORM\Mapping\Table'])) { if (isset($classAnnotations['Doctrine\ORM\Mapping\Table'])) {
$tableAnnot = $classAnnotations['Doctrine\ORM\Mapping\Table']; $tableAnnot = $classAnnotations['Doctrine\ORM\Mapping\Table'];
$primaryTable = array( $primaryTable = array(

View File

@ -205,9 +205,9 @@ class XmlDriver extends AbstractFileDriver
if (isset($idElement->{'sequence-generator'})) { if (isset($idElement->{'sequence-generator'})) {
$seqGenerator = $idElement->{'sequence-generator'}; $seqGenerator = $idElement->{'sequence-generator'};
$metadata->setSequenceGeneratorDefinition(array( $metadata->setSequenceGeneratorDefinition(array(
'sequenceName' => $seqGenerator->{'sequence-name'}, 'sequenceName' => (string)$seqGenerator['sequence-name'],
'allocationSize' => $seqGenerator->{'allocation-size'}, 'allocationSize' => (string)$seqGenerator['allocation-size'],
'initialValue' => $seqGeneratorAnnot->{'initial-value'} 'initialValue' => (string)$seqGeneratorAnnot['initial-value']
)); ));
} else if (isset($idElement->{'table-generator'})) { } else if (isset($idElement->{'table-generator'})) {
throw MappingException::tableIdGeneratorNotImplemented($className); throw MappingException::tableIdGeneratorNotImplemented($className);

View File

@ -815,7 +815,7 @@ class BasicEntityPersister
: $baseTableAlias; : $baseTableAlias;
$columnName = $this->_class->getQuotedColumnName($fieldName, $this->_platform); $columnName = $this->_class->getQuotedColumnName($fieldName, $this->_platform);
$orderBySql .= $orderBySql ? ', ' : 'ORDER BY '; $orderBySql .= $orderBySql ? ', ' : ' ORDER BY ';
$orderBySql .= $tableAlias . '.' . $columnName . ' ' . $orientation; $orderBySql .= $tableAlias . '.' . $columnName . ' ' . $orientation;
} }

View File

@ -53,7 +53,7 @@ class XmlExporter extends AbstractExporter
$xml->addAttribute('xmlns', 'http://doctrine-project.org/schemas/orm/doctrine-mapping'); $xml->addAttribute('xmlns', 'http://doctrine-project.org/schemas/orm/doctrine-mapping');
$xml->addAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $xml->addAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$xml->addAttribute('xsi:schemaLocation', 'http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd'); $xml->addAttribute('xsi:schemaLocation', 'http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd');
if ($metadata->isMappedSuperclass) { if ($metadata->isMappedSuperclass) {
$root = $xml->addChild('mapped-superclass'); $root = $xml->addChild('mapped-superclass');

View File

@ -37,6 +37,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
// Check state // Check state
$this->assertTrue(count($cm->getReflectionProperties()) > 0); $this->assertTrue(count($cm->getReflectionProperties()) > 0);
$this->assertEquals('Doctrine\Tests\Models\CMS', $cm->namespace);
$this->assertTrue($cm->reflClass instanceof \ReflectionClass); $this->assertTrue($cm->reflClass instanceof \ReflectionClass);
$this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->name); $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->name);
$this->assertEquals('UserParent', $cm->rootEntityName); $this->assertEquals('UserParent', $cm->rootEntityName);
@ -47,6 +48,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase
$this->assertTrue($cm->getAssociationMapping('phonenumbers') instanceof \Doctrine\ORM\Mapping\OneToOneMapping); $this->assertTrue($cm->getAssociationMapping('phonenumbers') instanceof \Doctrine\ORM\Mapping\OneToOneMapping);
$this->assertEquals(1, count($cm->associationMappings)); $this->assertEquals(1, count($cm->associationMappings));
$oneOneMapping = $cm->getAssociationMapping('phonenumbers'); $oneOneMapping = $cm->getAssociationMapping('phonenumbers');
$this->assertTrue($oneOneMapping->fetchMode == \Doctrine\ORM\Mapping\AssociationMapping::FETCH_LAZY);
$this->assertEquals('phonenumbers', $oneOneMapping->sourceFieldName); $this->assertEquals('phonenumbers', $oneOneMapping->sourceFieldName);
$this->assertEquals('Doctrine\Tests\Models\CMS\Bar', $oneOneMapping->targetEntityName); $this->assertEquals('Doctrine\Tests\Models\CMS\Bar', $oneOneMapping->targetEntityName);
} }