Newscoop\Entity\Snippet\SnippetTemplate::hasFields PHP Метод

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

Check if the Template has Fields
public hasFields ( ) : mixed
Результат mixed
    public function hasFields()
    {
        if (count($this->fields) >= 1) {
            return true;
        }
        return false;
    }

Usage Example

Пример #1
0
 /**
  * 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();
 }
All Usage Examples Of Newscoop\Entity\Snippet\SnippetTemplate::hasFields