You already received some good answers.
Additional points (for programming a slideshow extension):
- You might want to look at using a property of type FileReference in your Picture. You can also select that in the extension_builder. Your model might then contain something like this:
PictureModel.php:
/**
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @cascade remove
*/
protected $image = null;
- If you use 1:n for Gallery / Picture it means your images can only be in one Gallery at a time. An unnecessary restriction. I would suggust using m:n (but that is actually a general database modeling question).
- For m:n you need an extra table for the relations (by convention called something like tx_slideshow_gallery_picture_mm). It is definitely easier to let the extension_builder create that for you. Manually you would need to change at least the database model (ext_tables.sql), the Model and TCA. Especially the TCA can be a bit tricky to write from scratch.
Example TCA:
'picture' => [
'exclude' => true,
'label' => 'LLL:EXT:uniolslideshow/Resources/Private/Language/locallang_db.xlf:tx_uniolslideshow_domain_model_gallery.picture',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_uniolslideshow_domain_model_picture',
'MM' => 'tx_uniolslideshow_gallery_picture_mm',
'size' => 10,
'autoSizeMax' => 30,
'maxitems' => 9999,
'multiple' => 0,
'wizards' => [
// the fun starts here ...
- Later, you might decide that you don't even need an extra Picture class but just use a list of FileReferences ... but for educational purposes I would recommend to follow your initial approach.
- Trying to understand how things works instead of using a "builder" to create things for you is admirable, but consider that in TYPO3 a numer of files are necessary to create a model (TCA, Model, Repository, ext_tables.sql). Thus, doing everything manually can be tedious and errorprone. A combination of reading the docs, using extension_builder and modifying code yourself, also looking at existing extensions is in my opinion the way to go for education purposes. Later, a combination of using extension_builder to create a skeleton and then modifying it yourself works best for me.