Thx for replay - it's workig - almost.
I do like you said.
Now I have like this:
Gallery.php
<?php
class Gallery extends DataObject
{
static $db = array (
);
static $has_one = array (
'Attachment' => 'Image',
'AsortymentyPage' => 'AsortymentPage'
);
static $belongs_many_many = array(
);
public static $summary_fields = array(
);
function getCMSFields() {
return new FieldSet(
new UploadField('Attachment')
);
}
}
AsortymentPage.php
...
static $has_many = array (
'Images' => 'Image'
);
...
public function getCMSFields() {
$fields = parent::getCMSFields();
$f = new UploadField('Images', 'Zdjęcia', $this->Images());
$fields->addFieldToTab('Root.Galeria', $f);
return $fields;
}
...
And i Backend and frontend like this (attach)
I think I made a mess in static has_many and has_one :)
When I give code:
static $has_many = array (
'Images' => 'Gallery'
);
I have error.
Sorry for my bad English