/** * Opens a list and returns the contents of the list. * By default a list is interpreted as the own-list of the current bean. * If the list begins with the prefix 'shared-' the shared list of the * bean will be opened instead. Internal method. * * @return array */ private function openList() { $listOfBeans = array(); $listName = strpos($this->list, 'shared-') === 0 ? 'shared' . ucfirst(substr($this->list, 7)) : 'own' . ucfirst($this->list); if ($this->sqlSnippet) { if (preg_match('/^(ORDER|GROUP|HAVING|LIMIT|OFFSET|TOP)\\s+/i', ltrim($this->sqlSnippet))) { $beans = $this->bean->with($this->sqlSnippet, $this->sqlBindings)->{$listName}; } else { $beans = $this->bean->withCondition($this->sqlSnippet, $this->sqlBindings)->{$listName}; } } else { $beans = $this->bean->{$listName}; } foreach ($beans as $listBean) { $listOfBeans[] = $listBean->export(); } return $this->resp($listOfBeans); }