You are currently viewing the 1.0 branch api documentation. Switch to 1.1

1.0 Doctrine_Connection_UnitOfWork

Doctrine Connection UnitOfWork

Note: This class does not have the semantics of a real "Unit of Work" in 0.10/1.0. Database operations are not queued. All changes to objects are immediately written to the database. You can think of it as a unit of work in auto-flush mode. Re

Inheritence

Doctrine_Connection_UnitOfWork  < Doctrine_Connection_Module

Method Summary

Returns Name Description
array buildFlushTree The returned array has all the initialized components in 'correct' order. Basically this means that the records of those components can be saved safely in the order specified by the returned array.
boolean delete this event can be listened by the onPreDelete and onDelete listeners
boolean insert
processSingleInsert
save
saveAll
saveAssociations this method takes a diff of one-to-many / many-to-many original and current collections and applies the changes for example if original many-to-many related collection has records with primary keys 1,2 and 3 and the new collection has records with prima
saveGraph (The save() operation is always cascaded in 0.10/1.0).
saveRelated
boolean update
_cascadeDelete This is an application-level cascade. Related objects that participate in the cascade and are not yet loaded are fetched from the database. Exception: many-valued relations are always (re-)fetched from the database to make sure we have all of them.

Method Details

  • $tables an array of Doctrine_Table objects or component names

    (array) buildFlushTree($tables)

    buildFlushTree builds a flush tree that is used in transactions

    The returned array has all the initialized components in 'correct' order. Basically this means that the records of those components can be saved safely in the order specified by the returned array.

    Doctrine_Connection_UnitOfWork


  • (boolean) delete(( ) $record)

    Deletes the given record and all the related records that participate in an application-level delete cascade.

    this event can be listened by the onPreDelete and onDelete listeners

    Doctrine_Connection_UnitOfWork


  • $record record to be inserted

    (boolean) insert(( ) $record)

    inserts a record into database


  • processSingleInsert(( ) $record)


  • save(( ) $record)

    saves the given record


  • saveAll()

    saveAll persists all the pending records from all tables

    throws PDOException if something went wrong at database level


  • saveAssociations(( ) $record)

    this method takes a diff of one-to-many / many-to-many original and current collections and applies the changes
    for example if original many-to-many related collection has records with primary keys 1,2 and 3 and the new collection has records with prima

    throws Doctrine_Connection_Exception if something went wrong at database level


  • saveGraph(( ) $record)

    Saves the given record and all associated records.

    (The save() operation is always cascaded in 0.10/1.0).


  • saveRelated(( ) $record)

    saveRelated saves all related records to $record

    throws PDOException if something went wrong at database level


  • $record record to be updated

    (boolean) update(( ) $record)

    updates given record

    Doctrine_Connection_UnitOfWork


  • $record The record for which the delete operation will be cascaded.

    _cascadeDelete(( ) $record, [[[amp]]]$deletions)

    Cascades an ongoing delete operation to related objects. Applies only on relations that have 'delete' in their cascade options.

    This is an application-level cascade. Related objects that participate in the cascade and are not yet loaded are fetched from the database. Exception: many-valued relations are always (re-)fetched from the database to make sure we have all of them.

    throws PDOException If something went wrong at database level