protected function write(Mapper\Map $map, $data)
    {
        $reflectionProperty = new \ReflectionProperty($map->getLocalName(), $map->getIdentifier());
        $reflectionProperty->setAccessible(true);
        $identifier = $reflectionProperty->getValue($data);
        $new        = false;
        if (!$identifier) {
            $identifier = spl_object_hash($data);
            $new        = true;
        }
        $uri        = $this->buildUri($map->getRemoteName()) . '/' . $identifier;
        $result = (bool)file_put_contents(
            $uri,
            $this->descriptor->serialize($map, $data),
            false,
            $this->context ? : null
        );
        if ($result && $new) {
            $reflectionProperty->setValue($data, $identifier);
        }
        return $result;
    }
protected function write(Mapper\Map $map, $data)
    {
        $reflectionProperty = new \ReflectionProperty($map->getLocalName(), $map->getIdentifier());
        $reflectionProperty->setAccessible(true);
        $identifier = $reflectionProperty->getValue($data);
        $new        = false;
        if (!$identifier) {
            $identifier = spl_object_hash($data);
            $new        = true;
        }
        $uri        = $this->buildUri($map->getRemoteName()) . '/' . $identifier;
        $result = (bool)file_put_contents(
            $uri,
            $this->descriptor->serialize($map, $data),
            false,
            $this->context ? : null
        );
        if ($result && $new) {
            $reflectionProperty->setValue($data, $identifier);
        }
        return $result;
    }
@param Mapper\Map $map
@param            $data

@return bool