method relations documentation in bbn\Entities\Address

function($id) { /* * Fusionne l'historique de différents lieux et les supprime tous sauf le premier * * @var mixed $ids Un tableau d'IDs ou une liste d'arguments */ public function fusion($ids){ $args = is_array($ids) ? $ids : func_get_args(); if ( count($args) > 1 ){ $id = array_shift($args); $creation = [$this->db->selectOne('bbn_history', 'tst', [ 'uid' => $id, 'opr' => 'INSERT' ])]; foreach ( $args as $a ){ if ( $fn = $this->get_info($a) ){ $creation[] = $this->db->selectOne('bbn_history', 'tst', [ 'uid' => $a ]); $cols = $this->db->getFieldsList('apst_liens'); $cols['creation'] = 'tst'; $links = $this->db->rselectAll([ 'tables' => ['apst_liens'], 'fields' => $cols, 'join' => [ [ 'table' => 'bbn_history', 'on' => [ 'conditions' => [ [ 'field' => 'bbn_history.uid', 'operator' => 'eq', 'exp' => 'apst_liens.id' ] ], 'logic' => 'AND' ] ] ], 'where' => [ 'id_lieu' => $a ] ]); foreach ( $links as $link ){ $this->db->update('apst_liens', ['id_lieu' => $id], ['id' => $link['id']]); } $this->db->query(" UPDATE bbn_history SET uid = ? WHERE uid = ? AND opr LIKE 'UPDATE'", hex2bin($id), hex2bin($a) ); $this->db->query(" DELETE FROM bbn_history WHERE uid = ?", hex2bin($a) ); $this->db->query(" DELETE FROM bbn_addresses WHERE id = ?", hex2bin($a) ); } } $this->db->query(" UPDATE bbn_history SET tst = ? WHERE uid = ? AND opr LIKE 'INSERT'", min($creation), hex2bin($id) ); } return 1; } }

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.