name); */ return $this->name; } /** * Returns the last time when the element was modified. * @return \DateTime The time of the last edit. */ public function getLastModified() : \DateTime { return $this->lastModified; } /** * Returns the date/time when the element was created. * @return \DateTime The creation time of the part. */ public function getAddedDate() : \DateTime { return $this->addedDate; } /******************************************************************************** * * Setters * *********************************************************************************/ /** * Change the name of this element * * Spaces at the begin and at the end of the string will be removed * automatically in NamedDBElement::check_values_validity(). * So you don't have to do this yourself. * * @param string $new_name the new name * @return self */ public function setName(string $new_name) : self { $this->name = $new_name; return $this; } /****************************************************************************** * * Helpers * ******************************************************************************/ /** * Helper for updating the timestamp. It is automatically called by doctrine before persisting. * @ORM\PrePersist * @ORM\PreUpdate */ public function updatedTimestamps(): void { $this->lastModified = new \DateTime('now'); if ($this->addedDate === null) { $this->addedDate = new \DateTime('now'); } } }