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

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

Constructs the Snippet
public __construct ( SnippetTemplate $template )
$template Newscoop\Entity\Snippet\SnippetTemplate SnippetTemplate to set for this Snippet
    public function __construct(SnippetTemplate $template)
    {
        if (!$template->hasFields()) {
            throw new \Exception('SnippetTemplate should have fields');
        }
        if (!$template->getEnabled()) {
            throw new \Exception('SnippetTemplate should be enabled');
        }
        $this->fields = new ArrayCollection();
        $this->articles = new ArrayCollection();
        $this->setTemplate($template);
        $this->setCreated();
    }