private function generate() { //reset XMLmodel and all his variables for each iteration run this function $this->model = $this->getModel(); //fill data from DB to local variables $this->model->prepareOrders($this->date_from, $this->date_to); $this->orderStatusBean = $this->model->getOrderStatuses($this->model->getOrderStatusesIds()); $this->payment = $this->model->getPayments($this->model->getPaymentIds()); $this->shipping = $this->model->getShippings($this->model->getShipppingIds()); $this->customerBean = $this->model->getCustomers($this->model->getCustomerIds()); $this->orderProductBean = $this->model->getProducts($this->model->getOrderIds()); $orders = $this->model->getOrders(); if (count($orders) == 0) { return; //end of calling this recursive function } foreach ($orders as $order) { $this->showShopOrder($order); } if (count($orders) < $this->model->getStep()) { return; } if (!DEBUG) { $this->generate(); } }