/** * Realiza validaciones lógicas * * Los errores los pone en $this->_errores[] * Las alertas las pone en $this->_alertas[] * Este método lo debe implementar la entidad que lo necesite */ protected function validaLogico() { if ($this->BelongsTo == $this->getPrimaryKeyValue()) { $this->BelongsTo = 0; $this->_alertas[] = "El objeto no puede pertenecer a el mismo"; } if ($this->getPrimaryKeyValue() != '') { // Estoy validando antes de actualizar if ($this->IsSuper and $_SESSION['usuarioPortal']['IdPerfil'] != '1') { $this->_errores[] = "No se puede modificar, es un valor reservado"; } } if (trim($this->UrlTarget) != '') { // Desactivar la gestion de url amigable $this->LockUrlPrefix = 1; $this->UrlPrefix = ''; $this->LockSlug = 1; $this->Slug = ''; $this->UrlFriendly = ''; $urlAmigable = new CpanUrlAmigables(); $urlAmigable->borraUrl($_SESSION['idiomas']['actual'], $this->getClassName(), $this->getPrimaryKeyValue()); unset($urlAmigable); } // Asignar el nivel Jerárquico $nivelPadre = 0; if ($this->BelongsTo != 0) { $objetoPadre = new $this($this->BelongsTo); $nivelPadre = $objetoPadre->getNivelJerarquico(); unset($objetoPadre); } $this->setNivelJerarquico($nivelPadre + 1); }