Author: ts
Date: Wed Jan 9 21:01:20 2008
New Revision: 7116
Log:
- Renaming ezcPersistentObjectPropertyConversion ->
ezcPersistentPropertyConverter.
Modified:
trunk/PersistentObject/design/class_diagram.png
trunk/PersistentObject/src/interfaces/property_conversion.php
trunk/PersistentObject/src/internal/state_transformer.php
trunk/PersistentObject/src/object/persistent_object_property.php
trunk/PersistentObject/src/object/property_conversions/date.php
trunk/PersistentObject/src/persistent_autoload.php
trunk/PersistentObject/src/persistent_session.php
trunk/PersistentObject/tests/data/persistenttestobjectconversion.php
trunk/PersistentObject/tests/date_time_conversion_test.php
trunk/PersistentObject/tests/object_property_test.php
trunk/PersistentObject/tests/suite.php
Modified: trunk/PersistentObject/design/class_diagram.png
==============================================================================
Binary files - no diff available.
Modified: trunk/PersistentObject/src/interfaces/property_conversion.php
==============================================================================
--- trunk/PersistentObject/src/interfaces/property_conversion.php [iso-8859-1]
(original)
+++ trunk/PersistentObject/src/interfaces/property_conversion.php [iso-8859-1]
Wed Jan 9 21:01:20 2008
@@ -1,6 +1,6 @@
<?php
/**
- * File containing the ezcPersistentObjectPropertyConversion class.
+ * File containing the ezcPersistentPropertyConverter class.
*
* @version //autogen//
* @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
@@ -9,10 +9,10 @@
*/
/**
- * Interface that must be implemented by property conversion classes.
+ * Interface that must be implemented by property converter classes.
*
* This is the base interface that needs to be implemented by property
- * conversion classes. A property conversion object can be assigned to a
[EMAIL PROTECTED]
+ * converter classes. A property converter object can be assigned to a [EMAIL
PROTECTED]
* ezcPersistentObjectProperty} instance, to enable automatic manipulation of
* database values.
*
@@ -23,14 +23,14 @@
* toDatabase()} method will be called, receiving the current property value,
* and the return value of this method will be stored into the database.
*
- * The same property conversion object might be assigend to several [EMAIL
PROTECTED]
+ * The same property converter object might be assigend to several [EMAIL
PROTECTED]
* ezcPersistentObjectProperty} instances to reduce the number of needed
* objects.
*
* @package PersistentObject
* @version //autogen//
*/
-interface ezcPersistentObjectPropertyConversion
+interface ezcPersistentPropertyConverter
{
/**
* Converts the database value given to the property value.
@@ -68,10 +68,10 @@
* Method for de-serialization after var_export().
*
* This methid must be implemented to allow proper de-serialization of
- * conversion objects, when they are exported using [EMAIL PROTECTED]
var_export()}.
+ * converter objects, when they are exported using [EMAIL PROTECTED]
var_export()}.
*
* @param array $state
- * @return ezcPersistentObjectPropertyConversion
+ * @return ezcPersistentPropertyConverter
*/
public static function __set_state( array $state );
Modified: trunk/PersistentObject/src/internal/state_transformer.php
==============================================================================
--- trunk/PersistentObject/src/internal/state_transformer.php [iso-8859-1]
(original)
+++ trunk/PersistentObject/src/internal/state_transformer.php [iso-8859-1] Wed
Jan 9 21:01:20 2008
@@ -55,8 +55,8 @@
else
{
$result[$def->columns[$key]->propertyName] = (
- !is_null( $def->columns[$key]->conversion )
- ? $def->columns[$key]->conversion->fromDatabase(
$value )
+ !is_null( $def->columns[$key]->converter )
+ ? $def->columns[$key]->converter->fromDatabase( $value
)
: $value );
}
}
Modified: trunk/PersistentObject/src/object/persistent_object_property.php
==============================================================================
--- trunk/PersistentObject/src/object/persistent_object_property.php
[iso-8859-1] (original)
+++ trunk/PersistentObject/src/object/persistent_object_property.php
[iso-8859-1] Wed Jan 9 21:01:20 2008
@@ -24,8 +24,8 @@
* the PHP object.
* @property int $propertyType
* The type of the PHP property. See class constants PHP_TYPE_*.
- * @property ezcPersistentObjectPropertyConversion|null $conversion
- * A conversion object that will automatically perform conversions on
+ * @property ezcPersistentPropertyConverter|null $converter
+ * A converter object that will automatically perform converters on
* load and save of a property value.
*
* @package PersistentObject
@@ -49,7 +49,7 @@
'columnName' => null,
'propertyName' => null,
'propertyType' => self::PHP_TYPE_STRING,
- 'conversion' => null,
+ 'converter' => null,
);
/**
@@ -68,12 +68,12 @@
public function __construct( $columnName = null,
$propertyName = null,
$type = self::PHP_TYPE_STRING,
- $conversion = null )
+ $converter = null )
{
$this->columnName = $columnName;
$this->propertyName = $propertyName;
$this->propertyType = $type;
- $this->conversion = $conversion;
+ $this->converter = $converter;
}
/**
@@ -96,7 +96,7 @@
return new ezcPersistentObjectProperty(
$array['properties']['columnName'],
$array['properties']['propertyName'],
$array['properties']['propertyType'],
- ( isset(
$array['properties']['conversion'] ) ? $array['properties']['conversion'] :
null ) );
+ ( isset(
$array['properties']['converter'] ) ? $array['properties']['converter'] : null
) );
}
else
{
@@ -104,7 +104,7 @@
return new ezcPersistentObjectProperty( $array['columnName'],
$array['propertyName'],
$array['propertyType'],
- ( isset(
$array['conversion'] ) ? $array['conversion'] : null ) );
+ ( isset(
$array['converter'] ) ? $array['converter'] : null ) );
}
}
@@ -164,13 +164,13 @@
);
}
break;
- case 'conversion':
- if ( !( $propertyValue instanceof
ezcPersistentObjectPropertyConversion ) && !is_null( $propertyValue ) )
+ case 'converter':
+ if ( !( $propertyValue instanceof
ezcPersistentPropertyConverter ) && !is_null( $propertyValue ) )
{
throw new ezcBaseValueException(
$propertyName,
$propertyValue,
- 'ezcPersistentObjectPropertyConversion or null'
+ 'ezcPersistentPropertyConverter or null'
);
}
break;
Modified: trunk/PersistentObject/src/object/property_conversions/date.php
==============================================================================
--- trunk/PersistentObject/src/object/property_conversions/date.php
[iso-8859-1] (original)
+++ trunk/PersistentObject/src/object/property_conversions/date.php
[iso-8859-1] Wed Jan 9 21:01:20 2008
@@ -1,6 +1,6 @@
<?php
/**
- * File containing the ezcPersistentObjectPropertyDateTimeConversion class.
+ * File containing the ezcPersistentPropertyDateTimeConverter class.
*
* @version //autogen//
* @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
@@ -9,7 +9,7 @@
*/
/**
- * Property conversion class for date/time values.
+ * Property converter class for date/time values.
*
* An instance of this class can be used with [EMAIL PROTECTED]
* ezcPersistentObjectProperty} in a [EMAIL PROTECTED]
ezcPersistentObjectDefinition} to
@@ -19,7 +19,7 @@
* @package PersistentObject
* @version //autogen//
*/
-class ezcPersistentObjectPropertyDateTimeConversion implements
ezcPersistentObjectPropertyConversion
+class ezcPersistentPropertyDateTimeConverter implements
ezcPersistentPropertyConverter
{
/**
* Converts unix timestamp to DateTime instance.
@@ -85,14 +85,14 @@
* Method for de-serialization after var_export().
*
* This methid must be implemented to allow proper de-serialization of
- * conversion objects, when they are exported using [EMAIL PROTECTED]
var_export()}.
+ * converter objects, when they are exported using [EMAIL PROTECTED]
var_export()}.
*
* @param array $state
- * @return ezcPersistentObjectPropertyConversion
+ * @return ezcPersistentPropertyConverter
*/
public static function __set_state( array $state )
{
- return new ezcPersistentObjectPropertyDateTimeConversion();
+ return new ezcPersistentPropertyDateTimeConverter();
}
}
Modified: trunk/PersistentObject/src/persistent_autoload.php
==============================================================================
--- trunk/PersistentObject/src/persistent_autoload.php [iso-8859-1] (original)
+++ trunk/PersistentObject/src/persistent_autoload.php [iso-8859-1] Wed Jan 9
21:01:20 2008
@@ -24,6 +24,7 @@
'ezcPersistentSessionNotFoundException' =>
'PersistentObject/exceptions/session_not_found.php',
'ezcPersistentDefinitionManager' =>
'PersistentObject/interfaces/definition_manager.php',
'ezcPersistentIdentifierGenerator' =>
'PersistentObject/interfaces/identifier_generator.php',
+ 'ezcPersistentPropertyConverter' =>
'PersistentObject/interfaces/property_conversion.php',
'ezcPersistentRelation' =>
'PersistentObject/interfaces/relation.php',
'ezcPersistentCacheManager' =>
'PersistentObject/managers/cache_manager.php',
'ezcPersistentCodeManager' =>
'PersistentObject/managers/code_manager.php',
@@ -41,11 +42,10 @@
'ezcPersistentObjectIdProperty' =>
'PersistentObject/object/persistent_object_id_property.php',
'ezcPersistentObjectProperties' =>
'PersistentObject/object/persistent_object_properties.php',
'ezcPersistentObjectProperty' =>
'PersistentObject/object/persistent_object_property.php',
- 'ezcPersistentObjectPropertyConversion' =>
'PersistentObject/interfaces/property_conversion.php',
- 'ezcPersistentObjectPropertyDateTimeConversion' =>
'PersistentObject/object/property_conversions/date.php',
'ezcPersistentObjectRelations' =>
'PersistentObject/object/persistent_object_relations.php',
'ezcPersistentOneToManyRelation' =>
'PersistentObject/relations/one_to_many.php',
'ezcPersistentOneToOneRelation' =>
'PersistentObject/relations/one_to_one.php',
+ 'ezcPersistentPropertyDateTimeConverter' =>
'PersistentObject/object/property_conversions/date.php',
'ezcPersistentSequenceGenerator' =>
'PersistentObject/generators/sequence_generator.php',
'ezcPersistentSession' =>
'PersistentObject/persistent_session.php',
'ezcPersistentSessionInstance' =>
'PersistentObject/persistent_session_instance.php',
Modified: trunk/PersistentObject/src/persistent_session.php
==============================================================================
--- trunk/PersistentObject/src/persistent_session.php [iso-8859-1] (original)
+++ trunk/PersistentObject/src/persistent_session.php [iso-8859-1] Wed Jan 9
21:01:20 2008
@@ -1252,7 +1252,7 @@
continue;
}
$type = $def->properties[$name]->propertyType;
- $conv = $def->properties[$name]->conversion;
+ $conv = $def->properties[$name]->converter;
}
if ( !is_null( $value ) )
Modified: trunk/PersistentObject/tests/data/persistenttestobjectconversion.php
==============================================================================
--- trunk/PersistentObject/tests/data/persistenttestobjectconversion.php
[iso-8859-1] (original)
+++ trunk/PersistentObject/tests/data/persistenttestobjectconversion.php
[iso-8859-1] Wed Jan 9 21:01:20 2008
@@ -26,7 +26,7 @@
$def->properties['integer']->columnName = 'type_integer';
$def->properties['integer']->propertyName = 'integer';
$def->properties['integer']->propertyType =
ezcPersistentObjectProperty::PHP_TYPE_INT;
-$def->properties['integer']->conversion = new
ezcPersistentObjectPropertyDateTimeConversion();
+$def->properties['integer']->converter = new
ezcPersistentPropertyDateTimeConverter();
$def->properties['decimal'] = new ezcPersistentObjectProperty;
$def->properties['decimal']->columnName = 'type_decimal';
Modified: trunk/PersistentObject/tests/date_time_conversion_test.php
==============================================================================
--- trunk/PersistentObject/tests/date_time_conversion_test.php [iso-8859-1]
(original)
+++ trunk/PersistentObject/tests/date_time_conversion_test.php [iso-8859-1] Wed
Jan 9 21:01:20 2008
@@ -9,21 +9,21 @@
*/
/**
- * Tests the ezcPersistentObjectPropertyDateTimeConversion class.
+ * Tests the ezcPersistentPropertyDateTimeConverter class.
*
* @package PersistentObject
* @subpackage Tests
*/
-class ezcPersistentObjectPropertyDateTimeConversionTest extends ezcTestCase
+class ezcPersistentPropertyDateTimeConverterTest extends ezcTestCase
{
public static function suite()
{
- return new PHPUnit_Framework_TestSuite(
'ezcPersistentObjectPropertyDateTimeConversionTest' );
+ return new PHPUnit_Framework_TestSuite(
'ezcPersistentPropertyDateTimeConverterTest' );
}
public function testFromDatabaseSuccess()
{
- $conv = new ezcPersistentObjectPropertyDateTimeConversion();
+ $conv = new ezcPersistentPropertyDateTimeConverter();
$this->assertEquals(
new DateTime( '@327535200' ),
@@ -51,7 +51,7 @@
public function testFromDatabaseFailure()
{
- $conv = new ezcPersistentObjectPropertyDateTimeConversion();
+ $conv = new ezcPersistentPropertyDateTimeConverter();
$values = array(
'Test string',
@@ -66,7 +66,7 @@
try
{
$res = $conv->fromDatabase( $value );
- $this->fail( 'Exception not thrown on illegal conversion of
type ' . gettype( $value ) );
+ $this->fail( 'Exception not thrown on illegal converter of
type ' . gettype( $value ) );
}
catch ( ezcBaseValueException $e ) {}
}
@@ -74,7 +74,7 @@
public function testToDatabaseSuccess()
{
- $conv = new ezcPersistentObjectPropertyDateTimeConversion();
+ $conv = new ezcPersistentPropertyDateTimeConverter();
$this->assertEquals(
327535200,
@@ -96,7 +96,7 @@
public function testToDatabaseFailure()
{
- $conv = new ezcPersistentObjectPropertyDateTimeConversion();
+ $conv = new ezcPersistentPropertyDateTimeConverter();
$values = array(
23,
@@ -113,7 +113,7 @@
try
{
$res = $conv->toDatabase( $value );
- $this->fail( 'Exception not thrown on illegal conversion of
type ' . gettype( $value ) );
+ $this->fail( 'Exception not thrown on illegal converter of
type ' . gettype( $value ) );
}
catch ( ezcBaseValueException $e ) {}
}
Modified: trunk/PersistentObject/tests/object_property_test.php
==============================================================================
--- trunk/PersistentObject/tests/object_property_test.php [iso-8859-1]
(original)
+++ trunk/PersistentObject/tests/object_property_test.php [iso-8859-1] Wed Jan
9 21:01:20 2008
@@ -37,7 +37,7 @@
'columnName' => null,
'propertyName' => null,
'propertyType' => ezcPersistentObjectProperty::PHP_TYPE_STRING,
- 'conversion' => null
+ 'converter' => null
),
'properties',
$property
@@ -48,14 +48,14 @@
'column',
'property',
ezcPersistentObjectProperty::PHP_TYPE_INT,
- new ezcPersistentObjectPropertyDateTimeConversion()
+ new ezcPersistentPropertyDateTimeConverter()
);
$this->assertAttributeEquals(
array(
'columnName' => 'column',
'propertyName' => 'property',
'propertyType' => ezcPersistentObjectProperty::PHP_TYPE_INT,
- 'conversion' => new
ezcPersistentObjectPropertyDateTimeConversion(),
+ 'converter' => new ezcPersistentPropertyDateTimeConverter(),
),
'properties',
$property
@@ -70,7 +70,7 @@
23,
'foo',
ezcPersistentObjectProperty::PHP_TYPE_INT,
- new ezcPersistentObjectPropertyDateTimeConversion()
+ new ezcPersistentPropertyDateTimeConverter()
);
$this->fail( 'ezcBaseValueException not thrown on invalid value
for parameter $columnName.' );
}
@@ -81,7 +81,7 @@
'foo',
23,
ezcPersistentObjectProperty::PHP_TYPE_INT,
- new ezcPersistentObjectPropertyDateTimeConversion()
+ new ezcPersistentPropertyDateTimeConverter()
);
$this->fail( 'ezcBaseValueException not thrown on invalid value
for parameter $propertyName.' );
}
@@ -92,7 +92,7 @@
'foo',
'bar',
'baz',
- new ezcPersistentObjectPropertyDateTimeConversion()
+ new ezcPersistentPropertyDateTimeConverter()
);
$this->fail( 'ezcBaseValueException not thrown on invalid value of
type string for parameter $type.' );
}
@@ -116,7 +116,7 @@
'column',
'property',
ezcPersistentObjectProperty::PHP_TYPE_INT,
- new ezcPersistentObjectPropertyDateTimeConversion()
+ new ezcPersistentPropertyDateTimeConverter()
);
$this->assertEquals(
@@ -132,8 +132,8 @@
$property->propertyType
);
$this->assertEquals(
- new ezcPersistentObjectPropertyDateTimeConversion(),
- $property->conversion
+ new ezcPersistentPropertyDateTimeConverter(),
+ $property->converter
);
}
@@ -143,7 +143,7 @@
'column',
'property',
ezcPersistentObjectProperty::PHP_TYPE_INT,
- new ezcPersistentObjectPropertyDateTimeConversion()
+ new ezcPersistentPropertyDateTimeConverter()
);
try
{
@@ -162,7 +162,7 @@
$property->columnName = 'column';
$property->propertyName ='property';
$property->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
- $property->conversion = new
ezcPersistentObjectPropertyDateTimeConversion();
+ $property->converter = new ezcPersistentPropertyDateTimeConverter();
$this->assertEquals(
'column',
@@ -177,13 +177,13 @@
$property->propertyType
);
$this->assertEquals(
- new ezcPersistentObjectPropertyDateTimeConversion(),
- $property->conversion
+ new ezcPersistentPropertyDateTimeConverter(),
+ $property->converter
);
- $property->conversion = null;
+ $property->converter = null;
$this->assertNull(
- $property->conversion
+ $property->converter
);
}
@@ -207,7 +207,7 @@
);
$this->assertSetPropertyFails(
$property,
- 'conversion',
+ 'converter',
array( true, false, 'foo', 23.42, array(), new stdClass() )
);
}
@@ -228,8 +228,8 @@
'Property $propertyType seems not to be set.'
);
$this->assertTrue(
- isset( $property->conversion ),
- 'Property $conversion seems not to be set.'
+ isset( $property->converter ),
+ 'Property $converter seems not to be set.'
);
}
Modified: trunk/PersistentObject/tests/suite.php
==============================================================================
--- trunk/PersistentObject/tests/suite.php [iso-8859-1] (original)
+++ trunk/PersistentObject/tests/suite.php [iso-8859-1] Wed Jan 9 21:01:20 2008
@@ -64,7 +64,7 @@
$this->addTest( ezcPersistentObjectRelationsTest::suite() );
$this->addTest( ezcPersistentObjectPropertiesTest::suite() );
$this->addTest( ezcPersistentObjectColumnsTest::suite() );
- $this->addTest(
ezcPersistentObjectPropertyDateTimeConversionTest::suite() );
+ $this->addTest( ezcPersistentPropertyDateTimeConverterTest::suite() );
}
public static function suite()
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components