TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Core\Category\Collection\CategoryCollection Class Reference
Inheritance diagram for TYPO3\CMS\Core\Category\Collection\CategoryCollection:
TYPO3\CMS\Core\Collection\AbstractRecordCollection TYPO3\CMS\Core\Collection\EditableCollectionInterface TYPO3\CMS\Core\Collection\RecordCollectionInterface TYPO3\CMS\Core\Collection\PersistableCollectionInterface TYPO3\CMS\Core\Collection\SortableCollectionInterface TYPO3\CMS\Core\Collection\CollectionInterface TYPO3\CMS\Core\Collection\NameableCollectionInterface TYPO3\CMS\Frontend\Category\Collection\CategoryCollection

Public Member Functions

 __construct ($tableName=NULL, $fieldName=NULL)
 
 loadContents ()
 
 add ($data)
 
 addAll (\TYPO3\CMS\Core\Collection\CollectionInterface $other)
 
 remove ($data)
 
 removeAll ()
 
 setRelationFieldName ($field)
 
 getRelationFieldName ()
 
- Public Member Functions inherited from TYPO3\CMS\Core\Collection\AbstractRecordCollection
 __construct ()
 
 current ()
 
 next ()
 
 key ()
 
 valid ()
 
 rewind ()
 
 serialize ()
 
 unserialize ($serialized)
 
 count ()
 
 getTitle ()
 
 getUid ()
 
 getDescription ()
 
 setTitle ($title)
 
 setDescription ($desc)
 
 getItemTableName ()
 
 setItemTableName ($tableName)
 
 usort ($callbackFunction)
 
 moveItemAt ($currentPosition, $newPosition=0)
 
 getIdentifier ()
 
 setIdentifier ($id)
 
 toArray ()
 
 fromArray (array $array)
 
- Public Member Functions inherited from TYPO3\CMS\Core\Collection\PersistableCollectionInterface
 persist ()
 
- Public Member Functions inherited from TYPO3\CMS\Core\Collection\EditableCollectionInterface
 addAll (\TYPO3\CMS\Core\Collection\CollectionInterface $other)
 

Static Public Member Functions

static load ($id, $fillItems=FALSE, $tableName='', $fieldName='')
 
static getStorageTableName ()
 
static getStorageItemsField ()
 
- Static Public Member Functions inherited from TYPO3\CMS\Core\Collection\AbstractRecordCollection
static load ($id, $fillItems=FALSE)
 
static create (array $collectionRecord, $fillItems=FALSE)
 

Protected Member Functions

 getCollectedRecords ()
 
 getPersistableDataArray ()
 
 getDatabaseConnection ()
 
- Protected Member Functions inherited from TYPO3\CMS\Core\Collection\AbstractRecordCollection
 getPersistableDataArray ()
 
 getItemUidList ($includeTableName=TRUE)
 

Protected Attributes

 $relationFieldName = 'categories'
 
- Protected Attributes inherited from TYPO3\CMS\Core\Collection\AbstractRecordCollection
 $uid = 0
 
 $title
 
 $description
 
 $itemTableName
 
 $storage
 

Static Protected Attributes

static $storageTableName = 'sys_category'
 
- Static Protected Attributes inherited from TYPO3\CMS\Core\Collection\AbstractRecordCollection
static $storageTableName = 'sys_collection'
 
static $storageItemsField = 'items'
 

Detailed Description

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! Category Collection to handle records attached to a category

Author
Fabien Udriot fabie.nosp@m.n.ud.nosp@m.riot@.nosp@m.typo.nosp@m.3.org

Definition at line 21 of file CategoryCollection.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::__construct (   $tableName = NULL,
  $fieldName = NULL 
)

Creates this object.

Parameters
string$tableNameName of the table to be working on
string$fieldNameName of the field where the categories relations are defined
Exceptions

Definition at line 44 of file CategoryCollection.php.

References TYPO3\CMS\Core\Collection\AbstractRecordCollection\create(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), TYPO3\CMS\Core\Collection\AbstractRecordCollection\setItemTableName(), and TYPO3\CMS\Core\Category\Collection\CategoryCollection\setRelationFieldName().

Member Function Documentation

◆ add()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::add (   $data)

◆ addAll()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::addAll ( \TYPO3\CMS\Core\Collection\CollectionInterface  $other)

Adds a set of entries to the collection

Parameters
\TYPO3\CMS\Core\Collection\CollectionInterface$other
Returns
void

Definition at line 187 of file CategoryCollection.php.

References TYPO3\CMS\Core\Category\Collection\CategoryCollection\add().

◆ getCollectedRecords()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::getCollectedRecords ( )
protected

◆ getDatabaseConnection()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::getDatabaseConnection ( )
protected

◆ getPersistableDataArray()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::getPersistableDataArray ( )
protected

Returns an array of the persistable properties and contents which are processable by TCEmain. for internal usage in persist only.

Returns
array

Definition at line 163 of file CategoryCollection.php.

References TYPO3\CMS\Core\Collection\AbstractRecordCollection\getDescription(), TYPO3\CMS\Core\Collection\AbstractRecordCollection\getItemUidList(), and TYPO3\CMS\Core\Collection\AbstractRecordCollection\getTitle().

◆ getRelationFieldName()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::getRelationFieldName ( )

◆ getStorageItemsField()

static TYPO3\CMS\Core\Category\Collection\CategoryCollection::getStorageItemsField ( )
static

Getter for the storage items field

Returns
string

Definition at line 267 of file CategoryCollection.php.

◆ getStorageTableName()

static TYPO3\CMS\Core\Category\Collection\CategoryCollection::getStorageTableName ( )
static

Getter for the storage table name

Returns
string

Definition at line 258 of file CategoryCollection.php.

◆ load()

static TYPO3\CMS\Core\Category\Collection\CategoryCollection::load (   $id,
  $fillItems = FALSE,
  $tableName = '',
  $fieldName = '' 
)
static

Loads the collections with the given id from persistence For memory reasons, per default only f.e. title, database-table, identifier (what ever static data is defined) is loaded. Entries can be load on first access.

Parameters
integer$idId of database record to be loaded
boolean$fillItemsPopulates the entries directly on load, might be bad for memory on large collections
string$tableNameName of table from which entries should be loaded
string$fieldNameName of the categories relation field
Returns

Definition at line 90 of file CategoryCollection.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Tests\Functional\Category\Collection\CategoryCollectionTest\canLoadADummyCollectionFromDatabaseAndAddRecord(), and TYPO3\CMS\Core\Tests\Functional\Category\Collection\CategoryCollectionTest\isStorageItemsFieldEqualsToItems().

◆ loadContents()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::loadContents ( )

Populates the content-entries of the storage Queries the underlying storage for entries of the collection and adds them to the collection data. If the content entries of the storage had not been loaded on creation ($fillItems = false) this function is to be used for loading the contents afterwards.

Returns
void

Implements TYPO3\CMS\Core\Collection\PersistableCollectionInterface.

Definition at line 148 of file CategoryCollection.php.

References TYPO3\CMS\Core\Category\Collection\CategoryCollection\add(), TYPO3\CMS\Core\Category\Collection\CategoryCollection\getCollectedRecords(), and TYPO3\CMS\Core\Category\Collection\CategoryCollection\removeAll().

◆ remove()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::remove (   $data)

Removes the given entry from collection Note: not the given "index"

Parameters
mixed$data
Returns
void

Implements TYPO3\CMS\Core\Collection\EditableCollectionInterface.

Definition at line 200 of file CategoryCollection.php.

◆ removeAll()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::removeAll ( )

Removes all entries from the collection collection will be empty afterwards

Returns
void

Implements TYPO3\CMS\Core\Collection\EditableCollectionInterface.

Definition at line 217 of file CategoryCollection.php.

Referenced by TYPO3\CMS\Core\Category\Collection\CategoryCollection\loadContents().

◆ setRelationFieldName()

TYPO3\CMS\Core\Category\Collection\CategoryCollection::setRelationFieldName (   $field)

Sets the name of the categories relation field

Parameters
string$field

Definition at line 240 of file CategoryCollection.php.

Referenced by TYPO3\CMS\Core\Category\Collection\CategoryCollection\__construct().

Member Data Documentation

◆ $relationFieldName

TYPO3\CMS\Core\Category\Collection\CategoryCollection::$relationFieldName = 'categories'
protected

◆ $storageTableName

TYPO3\CMS\Core\Category\Collection\CategoryCollection::$storageTableName = 'sys_category'
staticprotected

Definition at line 28 of file CategoryCollection.php.