TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper:
TYPO3\CMS\Core\SingletonInterface Tx_Extbase_Persistence_Mapper_DataMapper

Public Member Functions

 map ($className, array $rows)
 
 getTargetType ($className, array $row)
 
 fetchRelated (\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName, $fieldValue='', $enableLazyLoading=TRUE)
 
 mapResultToPropertyValue (\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName, $result)
 
 countRelated (\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName, $fieldValue='')
 
 isPersistableProperty ($className, $propertyName)
 
 getDataMap ($className)
 
 convertClassNameToTableName ($className=NULL)
 
 convertPropertyNameToColumnName ($propertyName, $className=NULL)
 
 getType ($parentClassName, $propertyName)
 

Protected Member Functions

 mapSingleRow ($className, array $row)
 
 createEmptyObject ($className)
 
 thawProperties (\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $object, array $row)
 
 mapCoreType ($type, $value)
 
 mapDateTime ($value, $storageFormat=NULL, $targetType='DateTime')
 
 fetchRelatedEager (\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName, $fieldValue='')
 
 getEmptyRelationValue (\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName)
 
 getNonEmptyRelationValue (\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName, $fieldValue)
 
 getPreparedQuery (\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName, $fieldValue='')
 
 getConstraint (\TYPO3\CMS\Extbase\Persistence\QueryInterface $query, \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName, $fieldValue='', $relationTableMatchFields=array())
 
 getSource (\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName)
 
 mapObjectToClassProperty (\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName, $fieldValue)
 
 propertyMapsByForeignKey (\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName)
 

Protected Attributes

 $identityMap
 
 $reflectionService
 
 $qomFactory
 
 $persistenceSession
 
 $pageSelectObject
 
 $dataMaps = array()
 
 $dataMapFactory
 
 $queryFactory
 
 $referenceIndex
 
 $objectManager
 

Detailed Description

A mapper to map database tables configured in $TCA on domain objects.

Definition at line 22 of file DataMapper.php.

Member Function Documentation

◆ convertClassNameToTableName()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::convertClassNameToTableName (   $className = NULL)

Returns the selector (table) name for a given class name.

Parameters
string$className
Returns
string The selector name

Definition at line 548 of file DataMapper.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getDataMap().

◆ convertPropertyNameToColumnName()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::convertPropertyNameToColumnName (   $propertyName,
  $className = NULL 
)

Returns the column name for a given property name of the specified class.

Parameters
string$propertyName
string$className
Returns
string The column name

Definition at line 564 of file DataMapper.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getDataMap().

◆ countRelated()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::countRelated ( \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface  $parentObject,
  $propertyName,
  $fieldValue = '' 
)

Counts the number of related objects assigned to a property of a parent object

Parameters
\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface$parentObjectThe object instance this proxy is part of
string$propertyNameThe name of the proxied property in it's parent
mixed$fieldValueThe raw field value.
Returns
integer

Definition at line 507 of file DataMapper.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getPreparedQuery().

◆ createEmptyObject()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::createEmptyObject (   $className)
protected

Creates a skeleton of the specified object

Parameters
string$classNameName of the class to create a skeleton for
Exceptions

Definition at line 151 of file DataMapper.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\mapSingleRow().

◆ fetchRelated()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::fetchRelated ( \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface  $parentObject,
  $propertyName,
  $fieldValue = '',
  $enableLazyLoading = TRUE 
)

Fetches a collection of objects related to a property of a parent object

Parameters
\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface$parentObjectThe object instance this proxy is part of
string$propertyNameThe name of the proxied property in it's parent
mixed$fieldValueThe raw field value.
boolean$enableLazyLoadingA flag indication if the related objects should be lazy loaded
Returns
| The result

Definition at line 285 of file DataMapper.php.

References $result, and TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\fetchRelatedEager().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\mapObjectToClassProperty(), and TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\thawProperties().

◆ fetchRelatedEager()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::fetchRelatedEager ( \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface  $parentObject,
  $propertyName,
  $fieldValue = '' 
)
protected

Fetches the related objects from the storage backend.

Parameters
\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface$parentObjectThe object instance this proxy is part of
string$propertyNameThe name of the proxied property in it's parent
mixed$fieldValueThe raw field value.
Returns
mixed

Definition at line 311 of file DataMapper.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getEmptyRelationValue(), and TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getNonEmptyRelationValue().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\fetchRelated().

◆ getConstraint()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::getConstraint ( \TYPO3\CMS\Extbase\Persistence\QueryInterface  $query,
\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface  $parentObject,
  $propertyName,
  $fieldValue = '',
  $relationTableMatchFields = array() 
)
protected

Builds and returns the constraint for multi value properties.

Parameters
\TYPO3\CMS\Extbase\Persistence\QueryInterface$query
\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface$parentObject
string$propertyName
string$fieldValue
array$relationTableMatchFields
Returns
$constraint

Definition at line 375 of file DataMapper.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getDataMap(), and TYPO3\CMS\Core\Utility\GeneralUtility\intExplode().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getPreparedQuery().

◆ getDataMap()

◆ getEmptyRelationValue()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::getEmptyRelationValue ( \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface  $parentObject,
  $propertyName 
)
protected

◆ getNonEmptyRelationValue()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::getNonEmptyRelationValue ( \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface  $parentObject,
  $propertyName,
  $fieldValue 
)
protected
Parameters
\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface$parentObject
string$propertyName
string$fieldValue
Returns

Definition at line 332 of file DataMapper.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getPreparedQuery().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\fetchRelatedEager().

◆ getPreparedQuery()

◆ getSource()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::getSource ( \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface  $parentObject,
  $propertyName 
)
protected

Builds and returns the source to build a join for a m:n relation.

Parameters
\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface$parentObject
string$propertyName
Returns
$source

Definition at line 400 of file DataMapper.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getDataMap(), TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getType(), and TYPO3\CMS\Extbase\Persistence\Generic\Query\JCR_JOIN_TYPE_INNER.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getPreparedQuery().

◆ getTargetType()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::getTargetType (   $className,
array  $row 
)

Returns the target type for the given row.

Parameters
string$classNameThe name of the class
array$rowA single array with field_name => value pairs
Returns
string The target type (a class name)

Definition at line 109 of file DataMapper.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getDataMap().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\map().

◆ getType()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::getType (   $parentClassName,
  $propertyName 
)

Returns the type of a child object.

Parameters
string$parentClassNameThe class name of the object this proxy is part of
string$propertyNameThe name of the proxied property in it's parent
Exceptions

Definition at line 585 of file DataMapper.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getPreparedQuery(), and TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getSource().

◆ isPersistableProperty()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::isPersistableProperty (   $className,
  $propertyName 
)

Delegates the call to the Data Map. Returns TRUE if the property is persistable (configured in $TCA)

Parameters
string$classNameThe property name
string$propertyNameThe property name
Returns
boolean TRUE if the property is persistable (configured in $TCA)

Definition at line 520 of file DataMapper.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getDataMap().

◆ map()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::map (   $className,
array  $rows 
)

Maps the given rows on objects

Parameters
string$classNameThe name of the class
array$rowsAn array of arrays with field_name => value pairs
Returns
array An array of objects of the given class

Definition at line 94 of file DataMapper.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getTargetType(), and TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\mapSingleRow().

◆ mapCoreType()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::mapCoreType (   $type,
  $value 
)
protected

Map value to a core type

Parameters
string$type
mixed$value
Returns

Definition at line 248 of file DataMapper.php.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\thawProperties().

◆ mapDateTime()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::mapDateTime (   $value,
  $storageFormat = NULL,
  $targetType = 'DateTime' 
)
protected

Creates a DateTime from an unix timestamp or date/datetime value. If the input is empty, NULL is returned.

Parameters
integer | string$valueUnix timestamp or date/datetime value
NULL | string$storageFormatStorage format for native date/datetime fields
NULL | string$targetTypeThe object class name to be created
Returns

Definition at line 261 of file DataMapper.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\thawProperties().

◆ mapObjectToClassProperty()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::mapObjectToClassProperty ( \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface  $parentObject,
  $propertyName,
  $fieldValue 
)
protected

Returns the mapped classProperty from the identiyMap or mapResultToPropertyValue()

If the field value is empty and the column map has no parent key field name, the relation will be empty. If the identityMap has a registered object of the correct type and identity (fieldValue), this function returns that object. Otherwise, it proceeds with mapResultToPropertyValue().

Parameters
\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface$parentObject
string$propertyName
mixed$fieldValuethe raw field value
Returns
mixed
See also
mapResultToPropertyValue()

Definition at line 425 of file DataMapper.php.

References $result, TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\fetchRelated(), TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getEmptyRelationValue(), TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\mapResultToPropertyValue(), and TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\propertyMapsByForeignKey().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\thawProperties().

◆ mapResultToPropertyValue()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::mapResultToPropertyValue ( \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface  $parentObject,
  $propertyName,
  $result 
)

Returns the given result as property value of the specified property type.

Parameters
\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface$parentObject
string$propertyName
mixed$resultThe result
Returns
mixed

Definition at line 466 of file DataMapper.php.

References $result.

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\mapObjectToClassProperty(), and TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\thawProperties().

◆ mapSingleRow()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::mapSingleRow (   $className,
array  $row 
)
protected

Maps a single row on an object of the given class

Parameters
string$classNameThe name of the target class
array$rowA single array with field_name => value pairs
Returns
object An object of the given class

Definition at line 131 of file DataMapper.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\createEmptyObject(), and TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\thawProperties().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\map().

◆ propertyMapsByForeignKey()

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::propertyMapsByForeignKey ( \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface  $parentObject,
  $propertyName 
)
protected

Checks if the relation is based on a foreign key.

Parameters
\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface$parentObject
string$propertyName
Returns
boolean TRUE if the property is mapped

Definition at line 453 of file DataMapper.php.

References TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\getDataMap().

Referenced by TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper\mapObjectToClassProperty().

◆ thawProperties()

Member Data Documentation

◆ $dataMapFactory

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::$dataMapFactory
protected

Definition at line 66 of file DataMapper.php.

◆ $dataMaps

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::$dataMaps = array()
protected

Definition at line 60 of file DataMapper.php.

◆ $identityMap

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::$identityMap
protected

Definition at line 28 of file DataMapper.php.

◆ $objectManager

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::$objectManager
protected

Definition at line 85 of file DataMapper.php.

◆ $pageSelectObject

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::$pageSelectObject
protected

Definition at line 53 of file DataMapper.php.

◆ $persistenceSession

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::$persistenceSession
protected

Definition at line 46 of file DataMapper.php.

◆ $qomFactory

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::$qomFactory
protected

Definition at line 40 of file DataMapper.php.

◆ $queryFactory

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::$queryFactory
protected

Definition at line 72 of file DataMapper.php.

◆ $referenceIndex

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::$referenceIndex
protected

Definition at line 79 of file DataMapper.php.

◆ $reflectionService

TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::$reflectionService
protected

Definition at line 34 of file DataMapper.php.