コード例 #1
0
 public function validarMetadatos()
 {
     try {
         if (is_null($this->nombre) || empty($this->nombre)) {
             throw new Exception("El Contenido debe tener un nombre\n");
         }
         if (is_null($this->sinopsis) || empty($this->sinopsis)) {
             throw new Exception("El Contenido debe tener una sinopsis\n");
         }
         if (is_null($this->actores) || empty($this->actores)) {
             throw new Exception("El Contenido debe tener los actores\n");
         }
         $existeContenido = Contenido::GetOneByName($this->nombre);
         if (isset($existeContenido)) {
             throw new Exception("El Contenido ya existe\n");
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
コード例 #2
0
 protected static function mapear($rs, $mysql)
 {
     /* int */
     $id = MySQLAccess::GetSafeInt($rs, 0);
     //check if we found it
     if ($id == -1) {
         return null;
     }
     /* int */
     $id_meta = MySQLAccess::GetSafeInt($rs, 1);
     /* MetaContenido */
     $mc = MetaContenido::GetOne($id_meta, $mysql);
     /* TipoContenido */
     $tipoContenido = TipoContenido::valueOf($rs['tipo']);
     //MySQLAccess::GetSafeString($rs, 3);
     /* Contenido */
     $contenido = null;
     try {
         $contenido = new Contenido($tipoContenido, $mc, null);
     } catch (Exception $ex) {
         return null;
     }
     $contenido->setID($id);
     $contenido->setNombreCapitulo($rs['nombre_capitulo']);
     //MySQLAccess::GetSafeString($rs, 4)
     $contenido->setUrl($rs['url']);
     //MySQLAccess::GetSafeString($rs, 5)
     try {
         $contenido->setFechaEstreno(new \DateTime($rs['fecha_estreno']));
         //$rs.getDate(6)
     } catch (\Exception $ex) {
         // XX: dejo en null
     }
     $contenido->setImagen1($rs['imagen']);
     //MySQLAccess::GetSafeString($rs, 7)
     $contenido->setTrailer1($rs['trailer']);
     //MySQLAccess::GetSafeString($rs, 8)
     $contenido->setEstado(Estado::INTACTA);
     return $contenido;
 }
コード例 #3
0
 public static function Buscar($id_contenido)
 {
     // 			ContenidoLogica cl = null;
     $cl = null;
     // 			Contenido datosentidad = Contenido.GetOne($id_contenido);
     $datosentidad = Contenido::GetOne($id_contenido);
     if (isset($datosentidad)) {
         // 				$cl = new ContenidoLogica($datosentidad);
         $cl = new ContenidoLogica(null, $datosentidad);
     }
     return $cl;
 }