method getAll documentation in bbn\Entities\AbstractLinkType

Returns an array of link objects or empty array if no result found.

Example

X::dump($link->getAll()); // (array) [ bbn\Entities\Link { stdClass Object 'link': { 'id': '0ab0986031be11ecbb0c37346045384d', 'link_type': '0a9ebf0a31be11ecbb0c37346045384d', 'id_adherent': 99, 'id_tiers': '0aa1830231be11ecbb0c37346045384d', 'id_lieu': '0aa8204031be11ecbb0c37346045384d', 'id_option': '0aa9758a31be11ecbb0c37346045384d', 'cfg': null, } stdClass Object 'people': { 'id': '0aa1830231be11ecbb0c37346045384d', 'nom': 'a', 'prenom': 'aa', 'civilite': 'M', 'fullname': 'M aa a', 'email': null, 'portable': null, 'cfg': null }, stdClass Object 'address': { 'id': '0aa8204031be11ecbb0c37346045384d', 'adresse': 'address A', 'cp': 123, 'ville': 'Martigues', 'id_country': null, 'tel': null, 'fax': null, 'email': null }, stdClass Object 'option': { 'id': '0aa9758a31be11ecbb0c37346045384d', 'id_parent': '0aa8db0c31be11ecbb0c37346045384d', 'id_alias': null, 'num': null, 'code': 'P', 'text': 'foo', 'value': null, 'cfg': null } } ] function(bool $included_deleted = false) { $r = []; if ($links = $this->fetch()) { $id_tiers = []; $id_lieu = []; $id_options = []; $f = $this->fields; foreach ($links as $link) { $id_tiers[] = $this->parseId($link[$f['id_people']]) ?? ''; $id_lieu[] = $this->parseId($link[$f['id_address']]) ?? ''; $id_options[] = $this->parseId($link[$f['id_option']]) ?? ''; } // Here will fetch ALL linked items for all results in just 3 queries // Then later will assign every link together // To avoid executing too many queries $tables = $this->class_cfg['tables']; $people = $this->fetchLinks($tables['people'], $id_tiers); $addresses = $this->fetchLinks($tables['addresses'], $id_lieu); $options = $this->fetchLinks($tables['options'], $id_options); foreach ($links as $link) { $r[] = new Link( $link, $this->getLinkedItem($people, $link[$f['id_people']]), $this->getLinkedItem($addresses, $link[$f['id_address']]), $this->getLinkedItem($options, $link[$f['id_option']]) ); } } return $r; }

Returns an array of link objects or empty array if no result found. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.