Files
2meet-data-optimizer/includes/back-compat/trait-wpdo-anti-eav-aware-alias.php
T
wpdev efab023289 fix(back-compat): hook 橋改雙向 + alias 表修補 + 函式 shim(E1/E2/E5)
E1 雙向 hook 橋
  原本只做 tmdo_* → wpdo_* 單向轉發,但核心一律 do_action('wpdo_*')
  (core:69,275、custom-table-registry:110、options-manager:59),
  所以任何 add_action('tmdo_after_write') 之類的新契約永遠收不到事件。
  改為雙向,並以 $GLOBALS['tmdo_hook_relay_active'] 共用旗標防止
  A→B→A 迴圈與 listener 重複觸發。
  連帶:兩個 test bootstrap 補 do_action_ref_array() stub(單向時不會走到)。

E2 alias 表
  - 刪死條目 'TMDO_Notifier'(B 沒有這個類別,此行永不生效)
  - 補 'TMDO_Abstract_Notifier' => 'WPDO_Abstract_Notifier'(自訂 notifier 基底)
  - trait-wpdo-anti-eav-aware-alias.php 移除與 interface-wpdo-entity-adapter-alias.php
    重複的 WPDO_Entity_Adapter_Interface 宣告(composer 曾警告 Ambiguous class resolution)

E5 函式 shim:wpdo_run() / wpdo_load_textdomain() 委派到 tmdo_ 版本

unit 451 / integration 398 GREEN

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
2026-07-31 06:00:17 +08:00

36 lines
1.1 KiB
PHP

<?php
/**
* Backward-compat trait alias.
*
* PHP class_alias() does NOT support traits or interfaces. This file declares
* a thin wrapper trait `WPDO_Anti_EAV_Aware` that simply `use`s the new
* `TMDO_Anti_EAV_Aware` trait, preserving binary compatibility for sister
* plugins (2meet-brandcards, hub-core extensions, etc.) that still reference
* the old trait name.
*
* Loaded by `class-tmdo-back-compat.php` after the new trait is loaded.
*
* @package TMDO
* @since 0.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! trait_exists( 'WPDO_Anti_EAV_Aware', false ) && trait_exists( 'TMDO_Anti_EAV_Aware', false ) ) {
/**
* Backward-compat alias trait. Sister plugins using `use WPDO_Anti_EAV_Aware;`
* inherit all methods from `TMDO_Anti_EAV_Aware` transparently.
*
* Will emit `_doing_it_wrong()` notice in v0.2.0+.
*/
trait WPDO_Anti_EAV_Aware {
use TMDO_Anti_EAV_Aware;
}
}
// NOTE: WPDO_Entity_Adapter_Interface is declared in
// back-compat/interface-wpdo-entity-adapter-alias.php — it used to be duplicated
// here, which made composer's classmap ambiguous.