copy() public method

generates a copy of this object. Returns an instance of the same class of $this.
public copy ( boolean $deep = false ) : Doctrine_Record
$deep boolean whether to duplicates the objects targeted by the relations
return Doctrine_Record
Example #1
0
 public function generarVersion()
 {
     if ($this->maestro) {
         $nuevoContenido = parent::copy(false);
         $nuevoContenido->maestro = 0;
         $nuevoContenido->publicado = 0;
         $nuevoContenido->maestro_id = $this->id;
         $nuevoContenido->save();
         $this->logLastChange();
     }
 }
Example #2
0
 public function copy($deep = false)
 {
     $copia = parent::copy(false);
     if ($deep) {
         foreach ($this->Regiones as $r) {
             $copia->Regiones[] = $r;
         }
     }
     $copia->created_at = NULL;
     $copia->updated_at = NULL;
     return $copia;
 }
Example #3
0
 public function copy($deep = false)
 {
     $copia = parent::copy(false);
     if ($deep) {
         //Asignamos
         foreach ($this->Temas as $c) {
             $copia->Temas[] = $c;
         }
         foreach ($this->Tags as $t) {
             $copia->Tags[] = $t;
         }
         foreach ($this->HechosVida as $h) {
             $copia->HechosVida[] = $h;
         }
         foreach ($this->RangosEdad as $r) {
             $copia->RangosEdad[] = $r;
         }
         //emprendete
         foreach ($this->TemasEmpresa as $te) {
             $copia->TemasEmpresa[] = $te;
         }
         foreach ($this->HechosEmpresa as $he) {
             $copia->HechosEmpresa[] = $he;
         }
         foreach ($this->ApoyosEstado as $ae) {
             $copia->ApoyosEstado[] = $ae;
         }
         foreach ($this->TiposEmpresa as $te) {
             $copia->TiposEmpresa[] = $te;
         }
         foreach ($this->Rubros as $r) {
             $copia->Rubros[] = $r;
         }
         //Copiamos
         //foreach ($this->Documentos as $d)
         //    $copia->Documentos[] = $d->copy();
     }
     //Reseteamos fechas de actualizacion
     $copia->created_at = NULL;
     $copia->updated_at = NULL;
     return $copia;
 }