Tet banner

Custom Fields
Support MB Relationships One-to-many relationship on "bay_mb_relationships"

  • Creator
  • #18052
    Resolved Berg Informatik

    I try to realize a database structure like this.


    I have 3 post types:
    * Workout
    * Exercise
    * Set

    Thanks to the many-to-many plugin i can connect the Workout and Exercise with ease. But how can i connect the Set's with one-to-many relation to the "bay_mb_relationships" junction table.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
  • #18072
    Anh Tran


    If you want to force only one connection from one side of a relationship, please set 'max_clone' => 1 to the field on that side, like this:

    add_action( 'mb_relationships_init', function () {
                'id'   => 'workout_to_workout_exercises',
                'from' => array(
                    'object_type' => 'post',
                    'post_type' => 'workout',
                    'field' => array(
                        'max_clone' => 1, // Limit to 1 connection only.
                'to'   => array(
                    'object_type' => 'post',
                    'post_type' => 'workout_exercises',
    } );
    Berg Informatik

    Thanks for the tip. I just got to know the plugin. This plugin is very helpful for creating web applications with WordPress. A small minus is the missing attribute "Required" for some file types like "Map", "Autocomplete", "Color Picker" and "Advanced Image". Anyway, i think i will love the plugin more and more the deeper i dive into programming.

    Anh Tran

    Thank you for your kind words and your feedback. We keep improving the plugin and will try our best to make it more useful for you!

    Robert Wilson

    Using the example above, I'm wondering how one would go about ensuring that a workout_exercise is only created if a workout has been selected (assigned to it). Essentially, don't allow an exercise to be created without selecting a workout that it is related to. I hope that makes sense.

    Thanks you for creating such a fantastic set of plugins. I would love to see more examples using "Twig".

    Long Nguyen

    Hi Robert,

    The extension only helps you to create the relation between the posts, but thanks for the idea, I will discuss with the developer team to support the property 'required' => 1 to check this box not empty like the required fields.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.