/** * Creates a version of the current object and saves it. * * @param ConnectionInterface $con the connection to use * * @return ChildMenuItemVersion A version object */ public function addVersion($con = null) { $this->enforceVersion = false; $version = new ChildMenuItemVersion(); $version->setId($this->getId()); $version->setMenuId($this->getMenuId()); $version->setVisible($this->getVisible()); $version->setPosition($this->getPosition()); $version->setTypobj($this->getTypobj()); $version->setObjet($this->getObjet()); $version->setCreatedAt($this->getCreatedAt()); $version->setUpdatedAt($this->getUpdatedAt()); $version->setVersion($this->getVersion()); $version->setVersionCreatedAt($this->getVersionCreatedAt()); $version->setVersionCreatedBy($this->getVersionCreatedBy()); $version->setMenuItem($this); if (($related = $this->getMenu($con)) && $related->getVersion()) { $version->setMenuIdVersion($related->getVersion()); } $version->save($con); return $version; }