public function setTemplateProperty($propertyIdent)
    {
        if ($propertyIdent === null) {
            $this->templateProperty = null;

            return $this;
        }

        $property = null;
        if ($propertyIdent instanceof PropertyInterface) {
            $property      = $propertyIdent;
            $propertyIdent = $property->ident();
        } elseif (!is_string($propertyIdent)) {
            throw new InvalidArgumentException(
                'Property identifier must be a string'
            );
        }

        $obj = $this->obj();
        if (!$obj->hasProperty($propertyIdent)) {
            throw new UnexpectedValueException(sprintf(
                'The "%1$s" property is not defined on [%2$s]',
                $propertyIdent,
                get_class($this->obj())
            ));
        }

        if ($property === null) {
            $property = $obj->property($propertyIdent);
        }

        $this->templateProperty = $property;

        return $this;
    }