has_meta -> meta_exists
#13590 Avoid has_meta conflict with old method. #13581
This commit is contained in:
parent
1740f1e3e8
commit
a3cc5cc9bb
|
@ -263,7 +263,7 @@ abstract class WC_Data {
|
|||
* @param string $key
|
||||
* @return boolean
|
||||
*/
|
||||
public function has_meta( $key = '' ) {
|
||||
public function meta_exists( $key = '' ) {
|
||||
$this->maybe_read_meta_data();
|
||||
$array_keys = wp_list_pluck( $this->get_meta_data(), 'key' );
|
||||
return in_array( $key, $array_keys );
|
||||
|
|
|
@ -462,13 +462,9 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
|
|||
* version and should be removed in future versions.
|
||||
*
|
||||
* @deprecated
|
||||
* @return boolean|array of meta data.
|
||||
* @return array of meta data.
|
||||
*/
|
||||
public function has_meta( $key = '' ) {
|
||||
if ( ! is_numeric( $key ) ) {
|
||||
return parent::has_meta( $key );
|
||||
}
|
||||
|
||||
public function has_meta( $order_item_id ) {
|
||||
global $wpdb;
|
||||
|
||||
wc_deprecated_function( 'WC_Order::has_meta( $order_item_id )', '2.7', 'WC_Order_item::get_meta_data' );
|
||||
|
|
|
@ -132,9 +132,9 @@ class WC_Tests_CRUD_Data extends WC_Unit_Test_Case {
|
|||
$object->save_meta_data();
|
||||
$object = new WC_Mock_WC_Data( $object_id );
|
||||
|
||||
$this->assertTrue( $object->has_meta( 'test_meta_key' ) );
|
||||
$this->assertTrue( $object->has_meta( 'test_multi_meta_key' ) );
|
||||
$this->assertFalse( $object->has_meta( 'thiskeyisnothere' ) );
|
||||
$this->assertTrue( $object->meta_exists( 'test_meta_key' ) );
|
||||
$this->assertTrue( $object->meta_exists( 'test_multi_meta_key' ) );
|
||||
$this->assertFalse( $object->meta_exists( 'thiskeyisnothere' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue