public function testCopyToVersion() { $content = 'Harry the seagull bides his time.'; $this->object->setContent($content); $version = ObjectVersion::versionFromObject($this->object); $this->assertEquals($content, $version->getContent(self::KEY_PASSPHRASE)); $this->assertEquals($this->object->getContent(self::KEY_PASSPHRASE), $version->getContent(self::KEY_PASSPHRASE)); }
/** * Create version of this object from the current state of the database */ protected function saveVersion() { $previous = self::findFirst($this->id); // Prevent Phalcon from going into an infinite beforeUpdate loop if ($previous->content !== $this->content) { $version = ObjectVersion::versionFromObject($previous); $version->create(); } }