Esempio n. 1
0
 /**
  * Constructor.
  *
  * @param \PropelObjectCollection $entries
  * @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
  * @param \Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface $permissionGrantingStrategy
  * @param array $loadedSecurityIdentities
  * @param \Symfony\Component\Security\Acl\Model\AclInterface $parentAcl
  * @param bool $inherited
  */
 public function __construct(\PropelObjectCollection $entries, ObjectIdentityInterface $objectIdentity, PermissionGrantingStrategyInterface $permissionGrantingStrategy, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true)
 {
     if ($entries->getModel() !== $this->model) {
         throw new AclException(sprintf('The given collection does not contain models of class "%s" but of class "%s".', $this->model, $entries->getModel()));
     }
     foreach ($entries as $eachEntry) {
         if (null === $eachEntry->getFieldName() and null === $eachEntry->getObjectIdentityId()) {
             $this->classAces[] = new Entry($eachEntry, $this);
         }
         if (null !== $eachEntry->getFieldName() and null === $eachEntry->getObjectIdentityId()) {
             if (empty($this->classFieldAces[$eachEntry->getFieldName()])) {
                 $this->classFieldAces[$eachEntry->getFieldName()] = array();
                 $this->updateFields($eachEntry->getFieldName());
             }
             $this->classFieldAces[$eachEntry->getFieldName()][] = new FieldEntry($eachEntry, $this);
         }
         if (null === $eachEntry->getFieldName() and null !== $eachEntry->getObjectIdentityId()) {
             $this->objectAces[] = new Entry($eachEntry, $this);
         }
         if (null !== $eachEntry->getFieldName() and null !== $eachEntry->getObjectIdentityId()) {
             if (empty($this->objectFieldAces[$eachEntry->getFieldName()])) {
                 $this->objectFieldAces[$eachEntry->getFieldName()] = array();
                 $this->updateFields($eachEntry->getFieldName());
             }
             $this->objectFieldAces[$eachEntry->getFieldName()][] = new FieldEntry($eachEntry, $this);
         }
     }
     $this->objectIdentity = $objectIdentity;
     $this->permissionGrantingStrategy = $permissionGrantingStrategy;
     $this->parentAcl = $parentAcl;
     $this->inherited = $inherited;
     $this->loadedSecurityIdentities = $loadedSecurityIdentities;
     $this->fields = array_unique($this->fields);
 }
  /**
   * Form constructor.
   *
   * Available options:
   * - embedded_form_class: The class name of the forms to embed. Uses the model name by default.
   *                  (a form based on a collection of Book objects embeds BookForm objects)
   * - item_pattern:  The pattern used to name each embedded form. Defaults to '%index%'.
   * - add_delete:    Whether to add a delete widget for each object. Defaults to true.
   * - delete_name:   Name of the delete widget. Defaults to 'delete'.
   * - delete_widget: Optional delete widget object. If left null, uses a sfWidgetFormDelete instance.
   * - alert_text:    The text of the Javascript alert to show
   * - hide_parent:   Whether to hide the parent form when clicking the checkbox
   * - parent_level:  The number of times parentNode must be called to reach the parent to hide.
   *                  Recommended values: 6 for embedded form, 7 for merged form
   * - remove_fields: The list of fields to remove from the embedded object forms
   *
   * @param PropelCollection $collection A collection of Propel objects
   *                                     used to initialize default values
   * @param array            $options    An array of options
   * @param string           $CSRFSecret A CSRF secret (false to disable CSRF protection, null to use the global CSRF secret)
   *
   * @see sfForm
   */
  public function __construct($collection = null, $options = array(), $CSRFSecret = null)
  {
    $options = array_merge(array(
      'item_pattern'  => '%index%',
      'add_delete'    => false,
      'delete_name'   => 'delete',
      'delete_widget' => null,
      'remove_fields' => array(),
    ), $options);

    if (!$collection)
    {
      $this->model = $options['model'];
      $collection = new PropelObjectCollection();
      $collection->setModel($this->model);
      $this->collection = $collection;
    }
    else
    {
      if (!$collection instanceof PropelObjectCollection)
      {
        throw new sfException(sprintf('The "%s" form only accepts a PropelObjectCollection object.', get_class($this)));
      }
      $this->collection = $collection;
      $this->model = $collection->getModel();
    }

    $this->isEmpty = $this->getCollection()->isEmpty();

    parent::__construct(array(), $options, $CSRFSecret);
  }
 public function testTransformWithData()
 {
     $coll = new \PropelObjectCollection();
     $coll->setData(array('foo', 'bar'));
     $result = $this->transformer->transform($coll);
     $this->assertTrue(is_array($result));
     $this->assertCount(2, $result);
     $this->assertEquals('foo', $result[0]);
     $this->assertEquals('bar', $result[1]);
 }
 public function testSerializePropelObjectCollection()
 {
     $collection = new \PropelObjectCollection();
     $collection->setData(array(new TestSubject('lolo'), new TestSubject('pepe')));
     $json = $this->serializer->serialize($collection, 'json');
     $data = json_decode($json, true);
     $this->assertCount(2, $data);
     //will fail if PropelCollectionHandler not loaded
     foreach ($data as $testSubject) {
         $this->assertArrayHasKey('name', $testSubject);
     }
 }
 protected function createBooks($nb = 15, $con = null)
 {
     BookQuery::create()->deleteAll($con);
     $books = new PropelObjectCollection();
     $books->setModel('Book');
     for ($i = 0; $i < $nb; $i++) {
         $b = new Book();
         $b->setTitle('Book' . $i);
         $books[] = $b;
     }
     $books->save($con);
 }
 public function testFromArray()
 {
     $author = new Author();
     $author->setFirstName('Jane');
     $author->setLastName('Austen');
     $author->save();
     $books = array(array('Title' => 'Mansfield Park', 'AuthorId' => $author->getId()), array('Title' => 'Pride And PRejudice', 'AuthorId' => $author->getId()));
     $col = new PropelObjectCollection();
     $col->setModel('Book');
     $col->fromArray($books);
     $col->save();
     $nbBooks = PropelQuery::from('Book')->count();
     $this->assertEquals(6, $nbBooks);
     $booksByJane = PropelQuery::from('Book b')->join('b.Author a')->where('a.LastName = ?', 'Austen')->count();
     $this->assertEquals(2, $booksByJane);
 }
Esempio n. 7
0
 public function testConstruct()
 {
     $collection = new \PropelObjectCollection();
     $collection->setModel('Propel\\Bundle\\PropelAclBundle\\Model\\Acl\\Entry');
     $acl = new Acl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
     $model = $this->createEntry();
     $model->setAuditFailure(true);
     $model->setSecurityIdentity(SecurityIdentity::fromAclIdentity($this->getRoleSecurityIdentity()));
     $entry = new Entry($model, $acl);
     $this->assertEquals($model->getMask(), $entry->getMask());
     $this->assertEquals($model->getGranting(), $entry->isGranting());
     $this->assertEquals($model->getGrantingStrategy(), $entry->getStrategy());
     $this->assertEquals($model->getAuditFailure(), $entry->isAuditFailure());
     $this->assertEquals($model->getAuditSuccess(), $entry->isAuditSuccess());
     $this->assertEquals($this->getRoleSecurityIdentity(), $entry->getSecurityIdentity());
     return $entry;
 }
Esempio n. 8
0
    /**
     *
     * Prérempli la notification avec des responsables (sans sauvegarder la notification).
     * Si plusieurs responsables sont disponibles, un responsable 1 est pris en priorité pour remplir la notification,
     * un responsable 2 est ajouté si l'adresse est la même que le premier
     * Si trop de responsables sont disponibles, aucun choix arbitraire n'est fait et alors rien n'est rempli sur la notification
     * Si aucun responsable n'est disponible, la notification n'est pas remplie
     *
     * @return     boolean true ou false suivant que le remplissage a pu être effectué ou pas.
     *
     */
    public function preremplirResponsables() {
            $traitement = $this->getAbsenceEleveTraitement();
            if ($traitement === NULL) return false;

            $responsable_1_coll = new PropelObjectCollection();
            $responsable_2_coll = new PropelObjectCollection();
            foreach ($traitement->getResponsablesInformationsSaisies() as $responsable_information) {
                    if ($responsable_information == null) continue;
                    if ($responsable_information->getNiveauResponsabilite() == '1') {
                        $responsable_1_coll->add($responsable_information->getResponsableEleve());
                    } else if ($responsable_information->getNiveauResponsabilite() == '2') {
                        $responsable_2_coll->add($responsable_information->getResponsableEleve());
                    }
                    //si on ne peut pas choisir les responsables, on retourne sans remplir
                    if ($responsable_1_coll->count() > 1) return false;
            }

            if ($responsable_1_coll->isEmpty() && $responsable_2_coll->count() != 1) {
                //on ne peut pas choisir
                return false;
            }

            $responsable_eleve1 = $responsable_1_coll->getFirst();
            $responsable_eleve2 = $responsable_2_coll->getFirst();
            if ($responsable_eleve1 != null) {
                    $this->setEmail($responsable_eleve1->getMel());
                    $this->setTelephone($responsable_eleve1->getTelPort());
                    $this->setAdresseId($responsable_eleve1->getAdresseId());
                    $this->addResponsableEleve($responsable_eleve1);
            } else {
                    $this->setEmail($responsable_eleve2->getMel());
                    $this->setTelephone($responsable_eleve2->getTelPort());
                    $this->setAdresseId($responsable_eleve2->getAdresseId());
                    $this->addResponsableEleve($responsable_eleve2);
            }

            //on ajoute dans la liste des destinataires le resp 2 si il a la même adresse que le resp 1
            if ($responsable_eleve2 != null && $responsable_eleve1 != null && $responsable_eleve2->getAdresseId() == $responsable_eleve1->getAdresseId()) {
                    $this->addResponsableEleve($responsable_eleve2);
            }

            return true;
    }
Esempio n. 9
0
 public static function addProductWhenAjaxChangeActive($arg)
 {
     /* @var $model SProducts */
     $models = $arg['model'];
     /* @var $ci MY_Controller */
     $ci =& get_instance();
     if (!$models instanceof \PropelObjectCollection) {
         $model = $models;
         $models = new \PropelObjectCollection();
         $models->append($model);
     }
     foreach ($models as $model) {
         if ($model->getActive()) {
             $ci->db->where('trash_url', 'shop/product/' . $model->getUrl())->delete('trash');
         } else {
             $array = array('trash_id' => $model->getCategoryId(), 'trash_url' => 'shop/product/' . $model->getUrl(), 'trash_redirect_type' => 'category', 'trash_type' => '302', 'trash_redirect' => shop_url('category/' . $model->getMainCategory()->getFullPath()));
             $ci->db->insert('trash', $array);
         }
     }
 }
Esempio n. 10
0
 /**
  * @param	Factura $factura The factura object to remove.
  */
 public function removeFactura($factura)
 {
     if ($this->getFacturas()->contains($factura)) {
         $this->collFacturas->remove($this->collFacturas->search($factura));
         if (null === $this->facturasScheduledForDeletion) {
             $this->facturasScheduledForDeletion = clone $this->collFacturas;
             $this->facturasScheduledForDeletion->clear();
         }
         $this->facturasScheduledForDeletion[] = $factura;
         $factura->setTipoPago(null);
     }
 }
Esempio n. 11
0
 /**
  * Remove a User object to this object
  * through the user_skill cross reference table.
  *
  * @param User $user The UserSkill object to relate
  * @return Skill The current object (for fluent API support)
  */
 public function removeUser(User $user)
 {
     if ($this->getUsers()->contains($user)) {
         $this->collUsers->remove($this->collUsers->search($user));
         if (null === $this->usersScheduledForDeletion) {
             $this->usersScheduledForDeletion = clone $this->collUsers;
             $this->usersScheduledForDeletion->clear();
         }
         $this->usersScheduledForDeletion[] = $user;
     }
     return $this;
 }
Esempio n. 12
0
 /**
  * @param	Agenda $agenda The agenda object to remove.
  */
 public function removeAgenda($agenda)
 {
     if ($this->getAgendas()->contains($agenda)) {
         $this->collAgendas->remove($this->collAgendas->search($agenda));
         if (null === $this->agendasScheduledForDeletion) {
             $this->agendasScheduledForDeletion = clone $this->collAgendas;
             $this->agendasScheduledForDeletion->clear();
         }
         $this->agendasScheduledForDeletion[] = $agenda;
         $agenda->setAtencion(null);
     }
 }
 /**
  * @param	sfGuardUserPermission $sfGuardUserPermission The sfGuardUserPermission object to remove.
  */
 public function removesfGuardUserPermission($sfGuardUserPermission)
 {
     if ($this->getsfGuardUserPermissions()->contains($sfGuardUserPermission)) {
         $this->collsfGuardUserPermissions->remove($this->collsfGuardUserPermissions->search($sfGuardUserPermission));
         if (null === $this->sfGuardUserPermissionsScheduledForDeletion) {
             $this->sfGuardUserPermissionsScheduledForDeletion = clone $this->collsfGuardUserPermissions;
             $this->sfGuardUserPermissionsScheduledForDeletion->clear();
         }
         $this->sfGuardUserPermissionsScheduledForDeletion[] = $sfGuardUserPermission;
         $sfGuardUserPermission->setsfGuardPermission(null);
     }
 }
Esempio n. 14
0
 /**
  * @param	Transaccion $transaccion The transaccion object to remove.
  */
 public function removeTransaccion($transaccion)
 {
     if ($this->getTransaccions()->contains($transaccion)) {
         $this->collTransaccions->remove($this->collTransaccions->search($transaccion));
         if (null === $this->transaccionsScheduledForDeletion) {
             $this->transaccionsScheduledForDeletion = clone $this->collTransaccions;
             $this->transaccionsScheduledForDeletion->clear();
         }
         $this->transaccionsScheduledForDeletion[] = $transaccion;
         $transaccion->setTipoTransaccion(null);
     }
 }
Esempio n. 15
0
 /**
  * @param	sfGuardUserGroup $sfGuardUserGroup The sfGuardUserGroup object to remove.
  */
 public function removesfGuardUserGroup($sfGuardUserGroup)
 {
     if ($this->getsfGuardUserGroups()->contains($sfGuardUserGroup)) {
         $this->collsfGuardUserGroups->remove($this->collsfGuardUserGroups->search($sfGuardUserGroup));
         if (null === $this->sfGuardUserGroupsScheduledForDeletion) {
             $this->sfGuardUserGroupsScheduledForDeletion = clone $this->collsfGuardUserGroups;
             $this->sfGuardUserGroupsScheduledForDeletion->clear();
         }
         $this->sfGuardUserGroupsScheduledForDeletion[] = $sfGuardUserGroup;
         $sfGuardUserGroup->setsfGuardGroup(null);
     }
 }
Esempio n. 16
0
 /**
  * @param	JugadorMesa $jugadorMesa The jugadorMesa object to remove.
  */
 public function removeJugadorMesa($jugadorMesa)
 {
     if ($this->getJugadorMesas()->contains($jugadorMesa)) {
         $this->collJugadorMesas->remove($this->collJugadorMesas->search($jugadorMesa));
         if (null === $this->jugadorMesasScheduledForDeletion) {
             $this->jugadorMesasScheduledForDeletion = clone $this->collJugadorMesas;
             $this->jugadorMesasScheduledForDeletion->clear();
         }
         $this->jugadorMesasScheduledForDeletion[] = $jugadorMesa;
         $jugadorMesa->setJugador(null);
     }
 }
Esempio n. 17
0
 /**
  * Remove a Organization object to this object
  * through the plugin_organization cross reference table.
  *
  * @param Organization $organization The PluginOrganization object to relate
  * @return Plugin The current object (for fluent API support)
  */
 public function removeOrganization(Organization $organization)
 {
     if ($this->getOrganizations()->contains($organization)) {
         $this->collOrganizations->remove($this->collOrganizations->search($organization));
         if (null === $this->organizationsScheduledForDeletion) {
             $this->organizationsScheduledForDeletion = clone $this->collOrganizations;
             $this->organizationsScheduledForDeletion->clear();
         }
         $this->organizationsScheduledForDeletion[] = $organization;
     }
     return $this;
 }
Esempio n. 18
0
 /**
  * @param	Afiliado $afiliado The afiliado object to remove.
  */
 public function removeAfiliado($afiliado)
 {
     if ($this->getAfiliados()->contains($afiliado)) {
         $this->collAfiliados->remove($this->collAfiliados->search($afiliado));
         if (null === $this->afiliadosScheduledForDeletion) {
             $this->afiliadosScheduledForDeletion = clone $this->collAfiliados;
             $this->afiliadosScheduledForDeletion->clear();
         }
         $this->afiliadosScheduledForDeletion[] = $afiliado;
         $afiliado->setPlan(null);
     }
 }
Esempio n. 19
0
 /**
  * @param	State $state The state object to remove.
  */
 public function removeState($state)
 {
     if ($this->getStates()->contains($state)) {
         $this->collStates->remove($this->collStates->search($state));
         if (null === $this->statesScheduledForDeletion) {
             $this->statesScheduledForDeletion = clone $this->collStates;
             $this->statesScheduledForDeletion->clear();
         }
         $this->statesScheduledForDeletion[] = $state;
         $state->setCountry(null);
     }
 }
 /**
  * @param	SystemEventInstanceMessage $systemEventInstanceMessage The systemEventInstanceMessage object to remove.
  */
 public function removeSystemEventInstanceMessage($systemEventInstanceMessage)
 {
     if ($this->getSystemEventInstanceMessages()->contains($systemEventInstanceMessage)) {
         $this->collSystemEventInstanceMessages->remove($this->collSystemEventInstanceMessages->search($systemEventInstanceMessage));
         if (null === $this->systemEventInstanceMessagesScheduledForDeletion) {
             $this->systemEventInstanceMessagesScheduledForDeletion = clone $this->collSystemEventInstanceMessages;
             $this->systemEventInstanceMessagesScheduledForDeletion->clear();
         }
         $this->systemEventInstanceMessagesScheduledForDeletion[] = $systemEventInstanceMessage;
         $systemEventInstanceMessage->setSystemEventInstance(null);
     }
 }
Esempio n. 21
0
 /**
  * @param	Country $country The country object to remove.
  */
 public function removeCountry($country)
 {
     if ($this->getCountrys()->contains($country)) {
         $this->collCountrys->remove($this->collCountrys->search($country));
         if (null === $this->countrysScheduledForDeletion) {
             $this->countrysScheduledForDeletion = clone $this->collCountrys;
             $this->countrysScheduledForDeletion->clear();
         }
         $this->countrysScheduledForDeletion[] = $country;
         $country->setCurrency(null);
     }
 }
Esempio n. 22
0
 /**
  * @param	Producto $producto The producto object to remove.
  */
 public function removeProducto($producto)
 {
     if ($this->getProductos()->contains($producto)) {
         $this->collProductos->remove($this->collProductos->search($producto));
         if (null === $this->productosScheduledForDeletion) {
             $this->productosScheduledForDeletion = clone $this->collProductos;
             $this->productosScheduledForDeletion->clear();
         }
         $this->productosScheduledForDeletion[] = $producto;
         $producto->setTipoPresentacion(null);
     }
 }
Esempio n. 23
0
 /**
  * @param	Expedientegasto $expedientegasto The expedientegasto object to remove.
  * @return Gastofacturacion The current object (for fluent API support)
  */
 public function removeExpedientegasto($expedientegasto)
 {
     if ($this->getExpedientegastos()->contains($expedientegasto)) {
         $this->collExpedientegastos->remove($this->collExpedientegastos->search($expedientegasto));
         if (null === $this->expedientegastosScheduledForDeletion) {
             $this->expedientegastosScheduledForDeletion = clone $this->collExpedientegastos;
             $this->expedientegastosScheduledForDeletion->clear();
         }
         $this->expedientegastosScheduledForDeletion[] = $expedientegasto;
         $expedientegasto->setGastofacturacion(null);
     }
     return $this;
 }
 /**
  * @param	GalleryImage $galleryImage The galleryImage object to remove.
  * @return GalleryFolder The current object (for fluent API support)
  */
 public function removeGalleryImage($galleryImage)
 {
     if ($this->getGalleryImages()->contains($galleryImage)) {
         $this->collGalleryImages->remove($this->collGalleryImages->search($galleryImage));
         if (null === $this->galleryImagesScheduledForDeletion) {
             $this->galleryImagesScheduledForDeletion = clone $this->collGalleryImages;
             $this->galleryImagesScheduledForDeletion->clear();
         }
         $this->galleryImagesScheduledForDeletion[] = $galleryImage;
         $galleryImage->setGalleryFolder(null);
     }
     return $this;
 }
Esempio n. 25
0
 /**
  * @param	Articulo $articulo The articulo object to remove.
  * @return Tipo The current object (for fluent API support)
  */
 public function removeArticulo($articulo)
 {
     if ($this->getArticulos()->contains($articulo)) {
         $this->collArticulos->remove($this->collArticulos->search($articulo));
         if (null === $this->articulosScheduledForDeletion) {
             $this->articulosScheduledForDeletion = clone $this->collArticulos;
             $this->articulosScheduledForDeletion->clear();
         }
         $this->articulosScheduledForDeletion[] = clone $articulo;
         $articulo->setTipo(null);
     }
     return $this;
 }
Esempio n. 26
0
 /**
  * @param	Banco $banco The banco object to remove.
  * @return Conceptobanco The current object (for fluent API support)
  */
 public function removeBanco($banco)
 {
     if ($this->getBancos()->contains($banco)) {
         $this->collBancos->remove($this->collBancos->search($banco));
         if (null === $this->bancosScheduledForDeletion) {
             $this->bancosScheduledForDeletion = clone $this->collBancos;
             $this->bancosScheduledForDeletion->clear();
         }
         $this->bancosScheduledForDeletion[] = clone $banco;
         $banco->setConceptobanco(null);
     }
     return $this;
 }
Esempio n. 27
0
 /**
  * @param	LinkBarangRak $linkBarangRak The linkBarangRak object to remove.
  * @return Rak The current object (for fluent API support)
  */
 public function removeLinkBarangRak($linkBarangRak)
 {
     if ($this->getLinkBarangRaks()->contains($linkBarangRak)) {
         $this->collLinkBarangRaks->remove($this->collLinkBarangRaks->search($linkBarangRak));
         if (null === $this->linkBarangRaksScheduledForDeletion) {
             $this->linkBarangRaksScheduledForDeletion = clone $this->collLinkBarangRaks;
             $this->linkBarangRaksScheduledForDeletion->clear();
         }
         $this->linkBarangRaksScheduledForDeletion[] = $linkBarangRak;
         $linkBarangRak->setRak(null);
     }
     return $this;
 }
Esempio n. 28
0
 /**
  * @param	Consulta $consulta The consulta object to remove.
  * @return Consultorio The current object (for fluent API support)
  */
 public function removeConsulta($consulta)
 {
     if ($this->getConsultas()->contains($consulta)) {
         $this->collConsultas->remove($this->collConsultas->search($consulta));
         if (null === $this->consultasScheduledForDeletion) {
             $this->consultasScheduledForDeletion = clone $this->collConsultas;
             $this->consultasScheduledForDeletion->clear();
         }
         $this->consultasScheduledForDeletion[] = clone $consulta;
         $consulta->setConsultorio(null);
     }
     return $this;
 }
 /**
  * @param	DetailBarangMasuk $detailBarangMasuk The detailBarangMasuk object to remove.
  * @return BarangMasuk The current object (for fluent API support)
  */
 public function removeDetailBarangMasuk($detailBarangMasuk)
 {
     if ($this->getDetailBarangMasuks()->contains($detailBarangMasuk)) {
         $this->collDetailBarangMasuks->remove($this->collDetailBarangMasuks->search($detailBarangMasuk));
         if (null === $this->detailBarangMasuksScheduledForDeletion) {
             $this->detailBarangMasuksScheduledForDeletion = clone $this->collDetailBarangMasuks;
             $this->detailBarangMasuksScheduledForDeletion->clear();
         }
         $this->detailBarangMasuksScheduledForDeletion[] = $detailBarangMasuk;
         $detailBarangMasuk->setBarangMasuk(null);
     }
     return $this;
 }
Esempio n. 30
0
 /**
  * @param	Gastofacturacion $gastofacturacion The gastofacturacion object to remove.
  * @return Categoriagasto The current object (for fluent API support)
  */
 public function removeGastofacturacion($gastofacturacion)
 {
     if ($this->getGastofacturacions()->contains($gastofacturacion)) {
         $this->collGastofacturacions->remove($this->collGastofacturacions->search($gastofacturacion));
         if (null === $this->gastofacturacionsScheduledForDeletion) {
             $this->gastofacturacionsScheduledForDeletion = clone $this->collGastofacturacions;
             $this->gastofacturacionsScheduledForDeletion->clear();
         }
         $this->gastofacturacionsScheduledForDeletion[] = clone $gastofacturacion;
         $gastofacturacion->setCategoriagasto(null);
     }
     return $this;
 }