public function hasFields()
{
if (count($this->fields) >= 1) {
return true;
}
return false;
}
/** * Constructs the Snippet * * @param SnippetTemplate $template 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(); }