All pastes #436702 Raw Edit

Untitled

public php v1 · immutable
·published 2007-04-12 18:02 UTC
rendered paste body
// in Record.php    /**     * copyDeep     * returns a copy of this object and all its related objects     *     * @return Doctrine_Record     */    public function copyDeep(){        $newObject = $this->copy();        foreach( $this->getTable()->getRelations() as $relation ) {            if ( $relation->getType() == Doctrine_Relation::MANY_COMPOSITE   ||                 $relation->getType() == Doctrine_Relation::ONE_COMPOSITE ) {                $alias = $relation->getAlias();                foreach ( $this->$alias as $relatedObject ) {                    $newRelatedObject = $relatedObject->copyDeep();                    $newObject->{$alias}[] = $newRelatedObject;                }            }        }        return $newObject;    }