The trait Idable provides a method equalsId that in turn relies on the
method getId(). If this method does not exist on a class mixing in this
trait, the method will fail.
Adding the getId() as an abstract method to the trait will make sure it
is available.
Loading history...
12
// If $this->exists and dirty, parent::save() has to return true. If not,
13
// an error has occurred. Therefore we shouldn't save the translations.
14
if (parent::save($options)) {
15
$this->translations = $tempTranslations;
16
17
return $this->saveTranslations();
18
}
19
20
return false;
21
} else {
22
// If $this->exists and not dirty, parent::save() skips saving and returns
23
// false. So we have to save the translations
24
$this->translations = $tempTranslations;
25
26
return $this->saveTranslations();
27
}
28
} elseif (parent::save($options)) {
29
// We save the translations only if the instance is saved in the database.
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: