/**
  * WPML_TM_ICL_Translations constructor.
  *
  * @throws InvalidArgumentException if given data does not correspond to a
  * record in icl_translations
  *
  * @param WPML_TM_Records $tm_records
  * @param int|array       $id
  * @param string          $type translation id, trid_lang or id_prefix for now
  */
 public function __construct(&$tm_records, $id, $type = 'translation_id')
 {
     $this->wpdb = $tm_records->wpdb();
     $this->post_translations = $tm_records->get_post_translations();
     $this->term_translations = $tm_records->get_term_translations();
     parent::__construct($tm_records);
     if ($id > 0 && $type === 'translation_id') {
         $this->{$type} = $id;
     } elseif ($type === 'id_type_prefix' && isset($id['element_id']) && isset($id['type_prefix'])) {
         $this->build_from_element_id($id);
     } elseif ($type === 'trid_lang' && isset($id['trid']) && isset($id['language_code'])) {
         $this->build_from_trid($id);
     } else {
         throw new InvalidArgumentException('Unknown column: ' . $type . ' or invalid id: ' . serialize($id));
     }
 }