I've got a problem regarding a model in extbase with a 1:1 relation. My model "Beast" has a link to another Model "MissingBeast" which is realized through a 1:1 relation. I can successfully add add the MissingBeast object to the Beast object. But I don't know how the reset it.
The following code shows the property definition in the Model Beast
/**
* missingBeast
*
* @var Tx_Hobeast_Domain_Model_MissingBeast
* @lazy
*/
protected $missingBeast;
/**
* Returns the missingBeast
*
* @return Tx_Hobeast_Domain_Model_MissingBeast $missingBeast
*/
public function getMissingBeast() {
return $this->missingBeast;
}
/**
* Sets the missingBeast
*
* @param Tx_Hobeast_Domain_Model_MissingBeast $missingBeast
* @return void
*/
public function setMissingBeast(Tx_Hobeast_Domain_Model_MissingBeast $missingBeast) {
$this->missingBeast = $missingBeast;
}
the value for missingBeast in the database table of the Model Beast is just the id of the missingBeast. Which by default is 0.
Ho can I reset this id to 0 after a MissingBeast has been set? I've tried to just delete the missing beast like so:
$missingBeast = $this->service->missingBeastRepository->findByBeast($beast);
$this->service->missingBeastRepository->remove($missingBeast);
But when I do that the following query gets stuck in an infinite loop.
$query = $this->createQuery();
return $query->matching($query->equals("uid", $beast->getMissingBeast()))->execute()->count();
I'm using Typo version 4.7.8