public function inserir(Categoria $categoria)
 {
     //Objetivo deste metodo é inserir um objeto no banco, fazendo-o ter persistencia.
     //utilizaremos a abstracao do SQL da classe TsqlInstruction
     //1. Foreach dos atributos . PRa cada existencia de atributo é um valor a ser adicionado.
     $instrucao = new TSqlInsert();
     $instrucao->setEntity("categoria");
     if ($categoria->getId() != null) {
         $instrucao->setRowData("id", $categoria->getId());
     }
     if ($categoria->getNome() != null) {
         $instrucao->setRowData("nome", $categoria->getNome());
     }
     if ($categoria->getDescricao() != null) {
         $instrucao->setRowData("descricao", $categoria->getDescricao());
     }
     echo $instrucao->getInstruction();
     if ($this->Conexao->query($instrucao->getInstruction())) {
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
 /**
  * Declares an association between this object and a Categoria object.
  *
  * @param      Categoria $v
  * @return     Pelicula The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setCategoria(Categoria $v = null)
 {
     if ($v === null) {
         $this->setCategoriaId(NULL);
     } else {
         $this->setCategoriaId($v->getId());
     }
     $this->aCategoria = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Categoria object, it will not be re-added.
     if ($v !== null) {
         $v->addPelicula($this);
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Exclude object from result
  *
  * @param     Categoria $categoria Object to remove from the list of results
  *
  * @return    CategoriaQuery The current query, for fluid interface
  */
 public function prune($categoria = null)
 {
     if ($categoria) {
         $this->addUsingAlias(CategoriaPeer::ID, $categoria->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Exemplo n.º 4
0
 /**
  * Filter the query by a related Categoria object
  *
  * @param     Categoria|PropelCollection $categoria The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    PeliculaQuery The current query, for fluid interface
  */
 public function filterByCategoria($categoria, $comparison = null)
 {
     if ($categoria instanceof Categoria) {
         return $this->addUsingAlias(PeliculaPeer::CATEGORIA_ID, $categoria->getId(), $comparison);
     } elseif ($categoria instanceof PropelCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(PeliculaPeer::CATEGORIA_ID, $categoria->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByCategoria() only accepts arguments of type Categoria or PropelCollection');
     }
 }