You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
What version of the package/plugin are you using
v0.18.0
If at all possible, an isolated way to reproduce the behavior
use the \WPE\AtlasContentModeler\API\get_relationship function to lookup a reverse relationship. So Post_Type_A has a declared relationship to Post_Type_B with reverse relationship turned on. Try running get_relationship( $post_type_b_id, $relationship_name ) and you will get an error saying Content model field not found because the get_field_from_slug() function only checks for the model fields' slugs instead of slug and reverseSlug
The behavior you expect to see, and the actual behavior
The get_field_from_slug() function should be able to gracefully identify reverse relationships.
Just confirming I can reproduce this. get_relationship will give the relationship when passed the field API ID (the ID from A->B), but not when given the field's reverse ID (from B->A).
Results from two models, AAA and BBB when passing a 'B' entry ID (2624) to get_relationship ('bBBs' is the relationship field ID, 'aAAs' is the reverse ID):
wp>\WPE\AtlasContentModeler\API\get_relationship( 2624, 'bBBs' );
=> phar:///usr/local/Cellar/wp-cli/2.6.0/bin/wp/vendor/wp-cli/shell-command/src/WP_CLI/Shell/REPL.php:52:
class WPE\AtlasContentModeler\ContentConnect\Relationships\PostToPost#2223 (12) {
public $from =>
string(3) "aaa"
public $to =>
array(1) {
[0] =>
string(3) "bbb"
}
public $name =>
string(13) "1655733487943"
public $id =>
string(85) "wpe\atlascontentmodeler\contentconnect\relationships\posttopost-1655733487943-aaa-bbb"
public $enable_from_ui =>
bool(true)
public $enable_to_ui =>
bool(false)
public $from_labels =>
array(1) {
'name' =>
string(4) "BBBs"
}
public $to_labels =>
array(1) {
'name' =>
string(13) "1655733487943"
}
public $from_sortable =>
bool(false)
public $to_sortable =>
bool(false)
public $is_bidirectional =>
bool(true)
public $cardinality =>
string(10) "one-to-one"
}
wp>\WPE\AtlasContentModeler\API\get_relationship( 2624, 'aAAs' );
=> phar:///usr/local/Cellar/wp-cli/2.6.0/bin/wp/vendor/wp-cli/shell-command/src/WP_CLI/Shell/REPL.php:52:
class WP_Error#2336 (3) {
public $errors =>
array(1) {
'field_not_found' =>
array(1) {
[0] =>
string(29) "Content model field not found"
}
}
public $error_data =>
array(0) {
}
protected $additional_data =>
array(0) {
}
}
What version of the package/plugin are you using
v0.18.0
If at all possible, an isolated way to reproduce the behavior
use the
\WPE\AtlasContentModeler\API\get_relationship
function to lookup a reverse relationship. So Post_Type_A has a declared relationship to Post_Type_B with reverse relationship turned on. Try runningget_relationship( $post_type_b_id, $relationship_name )
and you will get an error sayingContent model field not found
because theget_field_from_slug()
function only checks for the model fields' slugs instead of slug and reverseSlugatlas-content-modeler/includes/publisher/lib/field-functions.php
Line 70 in aa21229
The behavior you expect to see, and the actual behavior
The
get_field_from_slug()
function should be able to gracefully identify reverse relationships.Probably something as simple as:
The text was updated successfully, but these errors were encountered: