protected function getAffinityKeyFromProto($proto)
    {
        if ($this->_affinity) {
            $names = $this->_affinity['affinityKey'];
            $names_arr = explode(".", $names);
            foreach ($names_arr as $name) {
                $getAttrMethod = 'get' . ucfirst($name);
                $proto = call_user_func_array(array($proto, $getAttrMethod), array());
            }
            return $proto;
        }
        echo "Cannot find the field in the proto\n";
    }