tareq1988 / wp-eloquent

Eloquent ORM for WordPress
https://tareq.co/2015/05/eloquent-orm-in-wordpress/
566 stars 135 forks source link

the user meta key should be "umeta_id"? #39

Closed iwillhappy1314 closed 5 years ago

iwillhappy1314 commented 6 years ago

the wp_usermeta data struchre:

CREATE TABLE `wp_usermeta` (
  `umeta_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `meta_key` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `meta_value` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

the user meta key is 'umeta_id'

but in the code of UserMeta model: https://github.com/tareq1988/wp-eloquent/blob/3388c399bcb4dd4ed5bd06f8790d7899198a4eb4/src/WP/UserMeta.php#L10

the $primaryKey is meta_id.

is there some magic method to convert this? or this is just a typo error?

Tofandel commented 5 years ago

I concur, that's a mistake in the lib