lib/Yucca/Component/SchemaManager.php
public function getShardingIdentifier($table, $shardingKey = null)
    {
        if (is_null($shardingKey)) {
            return null;
        }

        //Look for table config
        if (false === isset($this->schemaConfig[$table])) {
            throw new \InvalidArgumentException("$table is not in given configuration");
        }

        //Look for sharding strategy
        if (false === isset($this->schemaConfig[$table]['sharding_strategy'])) {
            return null;
        }
        $shardingStrategy = $this->schemaConfig[$table]['sharding_strategy'];
        if (false === isset($this->shardingStrategies[$shardingStrategy])) {
            throw new \Exception("Sharding strategy $shardingStrategy not found for table $table");
        }

        //Look for sharding identifier
        return $this->shardingStrategies[$shardingStrategy]->getShardingIdentifier(
            $this->schemaConfig[$table],
            $shardingKey
        );
    }
public function getShardingIdentifier($table, $shardingKey = null)
    {
        if (is_null($shardingKey)) {
            return null;
        }

        //Look for table config
        if (false === isset($this->schemaConfig[$table])) {
            throw new \InvalidArgumentException("$table is not in given configuration");
        }

        //Look for sharding strategy
        if (false === isset($this->schemaConfig[$table]['sharding_strategy'])) {
            return null;
        }
        $shardingStrategy = $this->schemaConfig[$table]['sharding_strategy'];
        if (false === isset($this->shardingStrategies[$shardingStrategy])) {
            throw new \Exception("Sharding strategy $shardingStrategy not found for table $table");
        }

        //Look for sharding identifier
        return $this->shardingStrategies[$shardingStrategy]->getShardingIdentifier(
            $this->schemaConfig[$table],
            $shardingKey
        );
    }
public function getShardingIdentifier ( $ table , $ shardingKey = null ) { if ( is_null ( $ shardingKey ) ) { return null ; } //Look for table config if ( false === isset ( $ this -> schemaConfig [ $ table ] ) ) { throw new \ InvalidArgumentException ( "$table is not in given configuration" ) ; } //Look for sharding strategy if ( false === isset ( $ this -> schemaConfig [ $ table ] [ 'sharding_strategy' ] ) ) { return null ; } $ shardingStrategy = $ this -> schemaConfig [ $ table ] [ 'sharding_strategy' ] ; if ( false === isset ( $ this -> shardingStrategies [ $ shardingStrategy ] ) ) { throw new \ Exception ( "Sharding strategy $shardingStrategy not found for table $table" ) ; } //Look for sharding identifier return $ this -> shardingStrategies [ $ shardingStrategy ] -> getShardingIdentifier ( $ this -> schemaConfig [ $ table ] , $ shardingKey ) ; }
@param string $table
@param mixed  $shardingKey

@return null
@throws \Exception
@param string $table @param mixed $shardingKey