Commit c43f9588 authored by romanb's avatar romanb

Cleanups, improvements, fixes.

parent 3cd7b954
This diff is collapsed.
......@@ -130,7 +130,7 @@ class Doctrine_ClassMetadata_Factory
protected function _addInheritedFields($subClass, $parentClass)
{
foreach ($parentClass->getColumns() as $name => $definition) {
foreach ($parentClass->getFieldMappings() as $name => $definition) {
$fullName = "$name as " . $parentClass->getFieldName($name);
$definition['inherited'] = true;
$subClass->mapColumn(
......@@ -246,7 +246,7 @@ class Doctrine_ClassMetadata_Factory
case 1: // A single identifier is in the mapping
foreach ($class->getIdentifier() as $pk) {
$columnName = $class->getColumnName($pk);
$thisColumns = $class->getColumns();
$thisColumns = $class->getFieldMappings();
$e = $thisColumns[$columnName];
$found = false;
......
......@@ -342,12 +342,12 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
$this->_data = array_merge($this->_data, $this->_id);
foreach ($this->_data as $k => $v) {
if ($v instanceof Doctrine_Entity && $this->_class->getTypeOf($k) != 'object') {
if ($v instanceof Doctrine_Entity && $this->_class->getTypeOfField($k) != 'object') {
unset($vars['_data'][$k]);
} else if ($v === Doctrine_Null::$INSTANCE) {
unset($vars['_data'][$k]);
} else {
switch ($this->_class->getTypeOf($k)) {
switch ($this->_class->getTypeOfField($k)) {
case 'array':
case 'object':
$vars['_data'][$k] = serialize($vars['_data'][$k]);
......@@ -400,7 +400,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
$this->_class = $this->_em->getClassMetadata($this->_entityName);
foreach ($this->_data as $k => $v) {
switch ($this->_class->getTypeOf($k)) {
switch ($this->_class->getTypeOfField($k)) {
case 'array':
case 'object':
$this->_data[$k] = unserialize($this->_data[$k]);
......@@ -1024,7 +1024,7 @@ abstract class Doctrine_Entity extends Doctrine_Access implements Serializable
}
foreach ($modifiedFields as $field) {
$type = $this->_class->getTypeOf($field);
$type = $this->_class->getTypeOfField($field);
if ($this->_data[$field] === Doctrine_Null::$INSTANCE) {
$dataSet[$field] = null;
......
This diff is collapsed.
<?php
/**
* A MappingException indicates that something is wrong with the mapping setup.
*
* @since 2.0
*/
class Doctrine_MappingException extends Doctrine_Exception
{
public static function identifierRequired($entityName)
{
return new self("No identifier specified for Entity '$entityName'."
. " Every Entity must have an identifier.");
}
}
?>
\ No newline at end of file
......@@ -133,7 +133,7 @@ class Doctrine_Query_Production_PathExpressionEndingWithAsterisk extends Doctrin
}
// Generating the SQL piece
$fields = $this->_queryComponent['metadata']->getMappedColumns();
$fields = $this->_queryComponent['metadata']->getFieldMappings();
$tableAlias = $parserResult->getTableAliasFromComponentAlias($componentAlias);
$str = '';
......
<?php
require_once 'lib/DoctrineTestInit.php';
class Orm_Entity_AccessorTestCase extends Doctrine_OrmTestCase
class Orm_Entity_AccessorTest extends Doctrine_OrmTestCase
{
public function testGetterSetterOverride()
{
$em = new Doctrine_EntityManager(new Doctrine_Connection_Mock());
{
$entity1 = new CustomAccessorMutatorTestEntity();
$entity1->username = 'romanb';
$this->assertEquals('romanb?!', $entity1->username);
......@@ -14,10 +12,14 @@ class Orm_Entity_AccessorTestCase extends Doctrine_OrmTestCase
$entity2 = new MagicAccessorMutatorTestEntity();
$entity2->username = 'romanb';
$this->assertEquals('romanb?!', $entity1->username);
}
}
/* Local test classes */
class CustomAccessorMutatorTestEntity extends Doctrine_Entity
{
public static function initMetadata($class)
......
......@@ -6,7 +6,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
require_once 'lib/DoctrineTestInit.php';
// Tests
require_once 'Orm/Entity/AccessorTestCase.php';
require_once 'Orm/Entity/AccessorTest.php';
require_once 'Orm/Entity/ConstructorTest.php';
class Orm_Entity_AllTests
......@@ -20,7 +20,7 @@ class Orm_Entity_AllTests
{
$suite = new Doctrine_TestSuite('Doctrine Orm Entity Tests');
$suite->addTestSuite('Orm_Entity_AccessorTestCase');
$suite->addTestSuite('Orm_Entity_AccessorTest');
$suite->addTestSuite('Orm_Entity_ConstructorTest');
return $suite;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment