public function copy( $deep = false )
    {
        $data = $this->data;
        foreach( static::$keyProperties as $key ) {
            $data[$key] = null;
        }

        foreach( $data as $key => $value ) {
            if( is_object( $value ) and !( $value instanceof self ) ) {
                $data[$key] = clone $value;
            }
        }

        // have repository?
        try {
            if( $repository = $this->r() ) {
                $entity = $repository->make( $data );
                return $entity;
            }
        } catch ( EntityMissingEntityManagerException $e ) {
        }

        $entity = clone $this;
        $entity->data = $data;

        return $entity;
    }
public function copy( $deep = false )
    {
        $data = $this->data;
        foreach( static::$keyProperties as $key ) {
            $data[$key] = null;
        }

        foreach( $data as $key => $value ) {
            if( is_object( $value ) and !( $value instanceof self ) ) {
                $data[$key] = clone $value;
            }
        }

        // have repository?
        try {
            if( $repository = $this->r() ) {
                $entity = $repository->make( $data );
                return $entity;
            }
        } catch ( EntityMissingEntityManagerException $e ) {
        }

        $entity = clone $this;
        $entity->data = $data;

        return $entity;
    }
public function copy ( $ deep = false ) { $ data = $ this -> data ; foreach ( static :: $ keyProperties as $ key ) { $ data [ $ key ] = null ; } foreach ( $ data as $ key => $ value ) { if ( is_object ( $ value ) and ! ( $ value instanceof self ) ) { $ data [ $ key ] = clone $ value ; } } // have repository? try { if ( $ repository = $ this -> r ( ) ) { $ entity = $ repository -> make ( $ data ) ; return $ entity ; } } catch ( EntityMissingEntityManagerException $ e ) { } $ entity = clone $ this ; $ entity -> data = $ data ; return $ entity ; }
Make a shallow copy of a object clearing it's key fields
@param bool # TODO. Pete/ This should probably be Bond\Schema property
@return Base
Make a shallow copy of a object clearing it s key fields