[TYPO3-mvc] DAM in ExtBase

Nils Blattner nb at cabag.ch
Fri May 21 10:09:45 CEST 2010


Am 20.05.10 19:56, schrieb S.Korth:
>
>> I simply try to get all tx_dam-entries out of the database. So I
>> extended your Model (Tx_ExtbaseDam_Domain_Model_Dam), set up a
>> repository and a simple fetchAll()
>
> Hey Chritian, i think you can just use the static methods within
> Tx_ExtbaseDam_Utility_Dam.
>
> I think you get the error because of missing TCA config when using a
> repository.
>
> Instead use: Tx_ExtbaseDam_Utility_Dam::get(.......);
>
>
> This returns for example Dam Objects.
>
> More Infos:
>
> http://forge.typo3.org/repositories/entry/extension-extbase_dam/trunk/Classes/Utility/Dam.php
>

The extension is not made to be extbase-way or beautiful at the moment.
It was a first draft that worked and lets you get Domain Models of the 
DAM-Table.

If you go to http://forge.typo3.org/wiki/extension-extbase_dam, the 
basic usage is explained.
You do not have to extend it unless you need additional fields.
In fact right now you cannot extend it or you will not get properly 
mapped objects. But I will fix that as soon as I get a second to adjust it.

Either way, to get all the DAM-Objects without adjusting anything in the 
current extension you could use the getByPath() function:

	/**
	 * Finds all the DAM-records within a specific path.
	 *
	 * @var string $path The file path.
	 * @var string $orderBy Any ordering that should be applied.
	 * @var int $limit The maximum amount of objects to return.
	 * @return array Array of Dam objects.
	 */
	public static function getByPath($path, $orderBy = '', $limit = 1000) {

So Tx_ExtbaseDam_Utility_Dam::getByPath('%') ought to work.

Im afraid you will have to check the model class for the actual 
fields/functions that are available at this time.
Just one comment: There is one function getFullPath() which returns the 
(relative) path+file so that you can use myDAMObject.fullPath in Fluid 
directly.
Just a convenience function, but hey :)

Either way, I hope you can make some use of it. As said, I will fix it 
so you can use extended models. And when you have reasonable 
suggestions, throw them at me.

Oh, and notify me when DAM relations work bug free with standard extbase 
so i can drop the extension ^^.

Regards

Nils


More information about the TYPO3-project-typo3v4mvc mailing list