/** * @return AbstractObject|\Pimcore\Model\Object\Participation * @throws \Exception */ public function makeParticipation() { $objectFolderPath = Plugin::getConfig()->get(Plugin::CONFIG_OBJECTFOLDERPATH); $objectFolder = AbstractObject::getByPath($objectFolderPath); if (!$objectFolder instanceof Folder) { throw new \Exception("Error: objectFolderPath [{$objectFolderPath}] " . "is not a valid object folder."); } // create basic object stuff $key = $this->createParticipationKey(); $participation = new Participation(); $participation->setKey($key); $participation->setParent($objectFolder); $participation->setPublished(true); $participation->setCreationDate(time()); $participation->SetIpCreated($_SERVER['REMOTE_ADDR']); $confirmation = $this->makeConfirmation(); $participation->setConfirmationCode($confirmation->createCode()); return $participation; }