This topic can be marked as Solved.
I leave it here in case someone else wants to make a pedigree.
I want to thank everybody on the forum ( and especially Swaiba for the explanation about Literalfields and thinking with me ), because i used a lot of code from the forum.
I started with a new approach.
Each Dog only has to have a Father and a Mother. BUT...the Father and Mother are in fact 'Dog' DataObjects.
So i made a verry simple DataObject for the Father and Mother.
class Father extends DataObject
{
static $has_one= array ('MyDog' => 'Dog');
}
Same for the Mother.
For the Dog i have;
stclass Dog extends DataObject
{
static $db = array( 'Name' => 'Varchar', //and a lot more !
static $has_one = array('Image'=> 'Image',
'MyFather' => 'Father',
'MyMother' => 'Mother'
);
Now the fun part is that i'm not using the Father and Mother DataObjects at all. Somehow i need to create these to prevent an error.
In fact all i need is the Dog.MyFatherID and Dog.MyMotherID.
I created a Dropdownfield for both Father and Mother in my Dog DO.
//Father
$mySet1 = DataObject::get('Dog', "Gendre = 'Male'", "PedigreeName ASC");
$map1 = $mySet1 ? $mySet1->toDropDownMap('ID', 'PedigreeName', 'Choose') : '';
$fields->addFieldToTab("Root.Main", new DropdownField('MyFatherID', 'Father', $map1 ));
//Mother
$mySet1 = DataObject::get('Dog', "Gendre = 'FeMale'", "PedigreeName ASC");
$map1 = $mySet1 ? $mySet1->toDropDownMap('ID', 'PedigreeName', 'Choose') : '';
$fields->addFieldToTab("Root.Main", new DropdownField('MyMotherID', 'Mother', $map1 ));
So i'm 'injecting' the FatherID and MotherID fields with a DogID.
Now i can get my Father and Mother with a function on my Dog DO. I get the Dog with the ID that was put in my MyFatherID.
function getMyDad() {
$father = dataObject::get_by_id('Dog', $this->MyFatherID);
return $father;
}
function getMyMom() {
$mother = dataObject::get_by_id('Dog', $this->MyMotherID);
return $mother;
}
In my template i can now buid a pedigree by putting a control MyDad inside a control MyDad inside a control MyDad etc.
ps. I could use $myDad.MyDad.Mydad etc. but i want to use the $Link to show a virtual page for every dog.
Well anyway ...i'm verry verry happy.
Thank u SlverStripe.