/** * @param string $format * * @throws OrmException * * @return string */ public function formatUpdatedOn($format) { if (!$this->hasUpdatedOn()) { throw OrmException::create()->setMessage('Cannot format updatedOn when no \\DateTime is set for %s in %s.')->with(get_called_class(), __METHOD__); } return $this->updatedOn->format($format); }
/** * @param string $string * * @throws OrmException * * @return $this */ public function setUuidFromString($string) { if (!Uuid::isValid($string)) { throw OrmException::create()->setMessage('Invalid Uuid string provided.'); } $this->uuid = Uuid::fromString($string); return $this; }
/** * @param OrmException $exception * * @return OrmException */ protected final function exception(OrmException $exception) { $type = $this->hasIdentityType() ? $this->getIdentityType() : 'null'; $identity = $this->hasIdentityType() ? $this->getIdentity() : 'null'; return OrmException::create()->setMessage('ORM entity "%s[%s:%s]" exception: %s')->with($exception, $this->getObjectName(true), $type, $identity, $exception->getMessage()); }