|
@@ 1659-1662 (lines=4) @@
|
| 1656 |
|
protected static function _get_object_from_entity_mapper($props_n_values, $classname){ |
| 1657 |
|
//TODO: will not work for Term_Relationships because they have no PK! |
| 1658 |
|
$primary_id_ref = self::_get_primary_key_name( $classname ); |
| 1659 |
|
if ( array_key_exists( $primary_id_ref, $props_n_values ) && !empty( $props_n_values[$primary_id_ref] ) ) { |
| 1660 |
|
$id = $props_n_values[$primary_id_ref]; |
| 1661 |
|
return self::_get_model($classname)->get_from_entity_map($id); |
| 1662 |
|
} |
| 1663 |
|
return false; |
| 1664 |
|
} |
| 1665 |
|
|
|
@@ 1684-1690 (lines=7) @@
|
| 1681 |
|
$existing = null; |
| 1682 |
|
if ( self::_get_model( $classname )->has_primary_key_field() ) { |
| 1683 |
|
$primary_id_ref = self::_get_primary_key_name( $classname ); |
| 1684 |
|
if ( array_key_exists( $primary_id_ref, $props_n_values ) |
| 1685 |
|
&& ! empty( $props_n_values[ $primary_id_ref ] ) |
| 1686 |
|
) { |
| 1687 |
|
$existing = self::_get_model( $classname, $timezone )->get_one_by_ID( |
| 1688 |
|
$props_n_values[ $primary_id_ref ] |
| 1689 |
|
); |
| 1690 |
|
} |
| 1691 |
|
} elseif ( self::_get_model( $classname, $timezone )->has_all_combined_primary_key_fields( $props_n_values ) ) { |
| 1692 |
|
//no primary key on this model, but there's still a matching item in the DB |
| 1693 |
|
$existing = self::_get_model( $classname, $timezone )->get_one_by_ID( |