Hello,
I have a form where a Breeder can add a Dog to the Database. In the form there is a Dropdownfield where they can choose an other dog that would be the kid of the new dog. Like Newdog is FatherOf....
Now i've come a long way ( in my opinion) but i have no idea how to update just one field in a record.
$dogStep = $this->getSavedStepByClass('DogDetailStep');
if($dogStep->loadData())
{
// Create the new Dog
$dog = new Dog();
$dogStep->saveInto($dog);
$dog->BreederID = $dog->BreederID;
$dog->write();
// New Dog is in Database
// I need the ID of the just created Dog
$thisdog = $dog->PedigreeName;
$newDog = DataObject::get_one('Dog', "PedigreeName = '$thisdog'");
$assignkidID = $dog->FatherOfID;
//FatherOfID is a field from the form where i choose which Dog is the kid.
$kid = DataObject::get_one('Dog', "ID = '$assignkidID'");
//So now i have the kid that i choose in the form.
//Now i have to fill the field $kid->MyFatherID with $newDog->ID
??????????
And that is where i'm lost. I've tryed
$kid->write();
but then it overwrites the whole dog with the new one, so i need to update just that one field MyFatherID.