Example #1
0
 /**
  * @param array $filterByTypes
  * @param bool $nonChildrenOnly
  * @return ImportCollection
  */
 public function getItemsCollection($filterByTypes = array(), $nonChildrenOnly = false)
 {
     if (is_null($this->_items)) {
         $this->_items = $this->_orderItemCollectionFactory->create()->setOrderFilter($this);
         if ($filterByTypes) {
             $this->_items->filterByTypes($filterByTypes);
         }
         if ($nonChildrenOnly) {
             $this->_items->filterByParent();
         }
         if ($this->getId()) {
             foreach ($this->_items as $item) {
                 $item->setOrder($this);
             }
         }
     }
     return $this->_items;
 }