/** * Store a newly created resource in storage. * * @return Response */ public function store() { $genero = new Genero(); $genero->nombre = Request::get('nombre'); $genero->descripcion = Request::get('descripcion'); $genero->funcionarioId = Auth::user()->id; $genero->save(); return Response::json(array('error' => false, 'generos' => $genero->toArray()), 200); }
/** * Exports the object as an array. * * You can specify the key type of the array by passing one of the class * type constants. * * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * Defaults to BasePeer::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * * @return array an associative array containing the field names (as keys) and field values */ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['Usuario_intereses'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['Usuario_intereses'][$this->getPrimaryKey()] = true; $keys = Usuario_interesesPeer::getFieldNames($keyType); $result = array($keys[0] => $this->getId(), $keys[1] => $this->getId_usuario(), $keys[2] => $this->getId_genero()); if ($includeForeignObjects) { if (null !== $this->aUsuario) { $result['Usuario'] = $this->aUsuario->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aGenero) { $result['Genero'] = $this->aGenero->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } return $result; }
/** * Exports the object as an array. * * You can specify the key type of the array by passing one of the class * type constants. * * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * Defaults to BasePeer::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * * @return array an associative array containing the field names (as keys) and field values */ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['Producto'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['Producto'][$this->getPrimaryKey()] = true; $keys = ProductoPeer::getFieldNames($keyType); $result = array($keys[0] => $this->getIdproducto(), $keys[1] => $this->getTitulo(), $keys[2] => $this->getIdartista(), $keys[3] => $this->getIdgenero(), $keys[4] => $this->getAnio(), $keys[5] => $this->getCantidadventas(), $keys[6] => $this->getStock(), $keys[7] => $this->getPrecio()); if ($includeForeignObjects) { if (null !== $this->aArtista) { $result['Artista'] = $this->aArtista->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aGenero) { $result['Genero'] = $this->aGenero->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collVentas) { $result['Ventas'] = $this->collVentas->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } return $result; }
/** * Exports the object as an array. * * You can specify the key type of the array by passing one of the class * type constants. * * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * Defaults to BasePeer::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * * @return array an associative array containing the field names (as keys) and field values */ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['Libro'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['Libro'][$this->getPrimaryKey()] = true; $keys = LibroPeer::getFieldNames($keyType); $result = array($keys[0] => $this->getId(), $keys[1] => $this->getNombre(), $keys[2] => $this->getFecha(), $keys[3] => $this->getId_genero(), $keys[4] => $this->getAutor(), $keys[5] => $this->getImage(), $keys[6] => $this->getSinopsis(), $keys[7] => $this->getFecha_ult_acc(), $keys[8] => $this->getHora_ult_acc(), $keys[9] => $this->getUsuario_ult_acc(), $keys[10] => $this->getId_privacidad(), $keys[11] => $this->getEs_editable(), $keys[12] => $this->getId_usuario(), $keys[13] => $this->getDebaja(), $keys[14] => $this->getEstado()); if ($includeForeignObjects) { if (null !== $this->aUsuarioRelatedByUsuario_ult_acc) { $result['UsuarioRelatedByUsuario_ult_acc'] = $this->aUsuarioRelatedByUsuario_ult_acc->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aPrivacidad) { $result['Privacidad'] = $this->aPrivacidad->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aGenero) { $result['Genero'] = $this->aGenero->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aUsuarioRelatedById_usuario) { $result['UsuarioRelatedById_usuario'] = $this->aUsuarioRelatedById_usuario->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collAudiolibros) { $result['Audiolibros'] = $this->collAudiolibros->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collCalificacions) { $result['Calificacions'] = $this->collCalificacions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collComentarios) { $result['Comentarios'] = $this->collComentarios->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collLibro_colaboradors) { $result['Libro_colaboradors'] = $this->collLibro_colaboradors->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collLibro_versions) { $result['Libro_versions'] = $this->collLibro_versions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collSolicituds) { $result['Solicituds'] = $this->collSolicituds->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collSlider_maes) { $result['Slider_maes'] = $this->collSlider_maes->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collPostulantess) { $result['Postulantess'] = $this->collPostulantess->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collClasificadoss) { $result['Clasificadoss'] = $this->collClasificadoss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } return $result; }