Newscoop\Entity\Snippet::setData PHP Метод

setData() публичный Метод

Set Snippet Data to the appropriate fields
public setData ( string $fieldName, string $fieldData = null ) : Newscoop\Entity\Snippet
$fieldName string the name of the SnippetField
$fieldData string the data of the SnippetField
Результат Newscoop\Entity\Snippet
    public function setData($fieldName, $fieldData = null)
    {
        if ($this->fields->containsKey($fieldName)) {
            $this->fields->get($fieldName)->setData($fieldData);
        } else {
            throw new \Exception('Snippet: "' . $this->name . '" does not have Field: "' . $fieldName . '"');
        }
        $this->setModified();
        return $this;
    }