public function rekey( Base $entity )
    {

        if( false !== $key = array_search( $entity, $this->instancesPersisted, true ) ) {

            $newKey = $entity->keyGet( $entity );

            if( isset( $this->instancesPersisted[$newKey] ) and $entity !== $this->instancesPersisted[$newKey] ) {
                throw new \RuntimeException( "Different object already exists with this same `key`. Clear collision." );
            }

            unset( $this->instancesPersisted[$key] );
            $this->instancesPersisted[$newKey] = $entity;
            return true;

        }

        return false;

    }
public function rekey( Base $entity )
    {

        if( false !== $key = array_search( $entity, $this->instancesPersisted, true ) ) {

            $newKey = $entity->keyGet( $entity );

            if( isset( $this->instancesPersisted[$newKey] ) and $entity !== $this->instancesPersisted[$newKey] ) {
                throw new \RuntimeException( "Different object already exists with this same `key`. Clear collision." );
            }

            unset( $this->instancesPersisted[$key] );
            $this->instancesPersisted[$newKey] = $entity;
            return true;

        }

        return false;

    }
public function rekey ( Base $ entity ) { if ( false !== $ key = array_search ( $ entity , $ this -> instancesPersisted , true ) ) { $ newKey = $ entity -> keyGet ( $ entity ) ; if ( isset ( $ this -> instancesPersisted [ $ newKey ] ) and $ entity !== $ this -> instancesPersisted [ $ newKey ] ) { throw new \ RuntimeException ( "Different object already exists with this same `key`. Clear collision." ) ; } unset ( $ this -> instancesPersisted [ $ key ] ) ; $ this -> instancesPersisted [ $ newKey ] = $ entity ; return true ; } return false ; }
A entity's key has changed. If it is in the repository this'll need rekeying
@param Base $entity
A entity s key has changed . If it is in the repository this ll need rekeying