method merge documentation in bbn\Appui\Option
Updates an option's row by merging the data and cfg.
Example
X::dump($opt->merge(12, [
  'id_parent' => $opt->fromCode('bbn_ide'),
  'text' => 'My new option',
  'code' => 'new_opt',
  'myProperty' => 'my value'
  'cfg' => [
    'sortable' => true,
    'Description' => "I am a cool option"
  ]
]);
// (int) 1
function(string $id, array $data, array $cfg = NULL)
  {
    if ($this->check()
        && ($o = $this->option($id))
    ) {
      $c =& $this->fields;
      if (!empty($data)) {
        $data = array_merge($o, $data);
        $this->_prepare($data);
        if (isset($data[$c['id']])) {
          unset($data[$c['id']]);
        }
      }
      if ($cfg) {
        $ocfg        = $this->getRawCfg($id);
        $data[$c['cfg']] = json_encode(array_merge($ocfg ? json_decode($ocfg, true) : [], $cfg));
      }
      // id_parent cannot be edited this way
      if ($res = $this->db->update(
        $this->class_cfg['table'],
        $data,
        [$c['id'] => $id]
      )
      ) {
        $this->deleteCache($id);
        return $res;
      }
      return 0;
    }
    return null;
  }
  Updates an option's row by merging the data and cfg. 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.                
                
              
              
                
                
              
             
           
          
          
          
            
            © 2011-2025 
BBN Solutions