public function toDefinitionObject()
    {
        $definition = array('type' => $this->type->getName());
        if ($this->id != null) {
            $definition['id'] = $this->id;
        }
        if ($this->label != null) {
            $definition['label'] = $this->label;
        }

        return (object) $definition;
    }