Same entitySame entity relationship

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gundogduyakici
    Senior Member
    • Mar 2018
    • 165

    Same entitySame entity relationship

    I want to associate and select the same entity. I can do this for a different entity, but how can I do it for the same entity?
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    The same,as with other entity. Try in Entity Manager. The names in relationship has to be unique

    Comment

    • gundogduyakici
      Senior Member
      • Mar 2018
      • 165

      #3
      Fields

      "careerGroup": {
      "type": "link",
      "tooltip": true,
      "required": true,
      "view": "career:views/career-groups/fields/career"
      },
      "prevCareerStep": {
      "type": "link",
      "tooltip": true,
      "required": true,
      "view": "career:views/career-steps/fields/career"
      },
      "nextCareerStep": {
      "type": "link",
      "tooltip": true,
      "required": true,
      "view": "career:views/career-steps/fields/career"
      },

      Relations

      "careerGroup": {
      "type": "belongsTo",
      "entity": "CareerGroups"
      },
      "prevCareerStep": {
      "type": "belongsTo",
      "entity": "CareerSteps"
      },
      "nextCareerStep": {
      "type": "belongsTo",
      "entity": "CareerSteps"
      },

      just careerGroup worked.
      example relation photo is attached.
      Attached Files

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        on the layout prevCareerSteps. You don't have such field

        Comment

        • gundogduyakici
          Senior Member
          • Mar 2018
          • 165

          #5
          Layout

          [
          {
          "label": "",
          "rows": [
          [
          {
          "name": "name"
          },
          {
          "name": "careerGroup"
          }
          ],
          [
          {
          "name": "prevCareerSteps"
          },
          {
          "name": "nextCareerSteps"
          }
          ],
          [
          {
          "name": "paymentPeriod"
          }
          ]
          ]
          }
          ]

          There is.

          Comment

          • tanya
            Senior Member
            • Jun 2014
            • 4308

            #6
            Originally posted by gundogduyakici
            Fields

            "careerGroup": {
            "type": "link",
            "tooltip": true,
            "required": true,
            "view": "career:views/career-groups/fields/career"
            },
            "prevCareerStep": {
            "type": "link",
            "tooltip": true,
            "required": true,
            "view": "career:views/career-steps/fields/career"
            },
            "nextCareerStep": {
            "type": "link",
            "tooltip": true,
            "required": true,
            "view": "career:views/career-steps/fields/career"
            },
            no, you didn't define them in entityDfes.... prevCareerStep != prevCareerSteps

            Comment

            • gundogduyakici
              Senior Member
              • Mar 2018
              • 165

              #7
              Yes, I am saying that. I'm not trying to show relationships in the same entity. Assets in the same beings. Like career groups. You know what I mean? tanya


              prevCareerStep == CareerSteps
              nextCareerStep == CareerSteps

              Comment

              • tanya
                Senior Member
                • Jun 2014
                • 4308

                #8
                What I tried to say you - in entityDefs you defined the field prevCareerStep, on the layout you added prevCareerSteps (s letter in the end). You want to display the field you don't have.
                You need link field (singular Step) or linkMultiple (plural Steps)?

                Comment

                • gundogduyakici
                  Senior Member
                  • Mar 2018
                  • 165

                  #9
                  Originally posted by tanya
                  What I tried to say you - in entityDefs you defined the field prevCareerStep, on the layout you added prevCareerSteps (s letter in the end). You want to display the field you don't have.
                  You need link field (singular Step) or linkMultiple (plural Steps)?
                  Yes, I'm sorry. I resolved this. But it did not work.
                  I want link (singular Step).

                  Comment

                  • tanya
                    Senior Member
                    • Jun 2014
                    • 4308

                    #10
                    I asked you to create such relation in Entity Manager, to see all needed definitions

                    Code:
                    {
                        "fields": {
                            "tasksChildren": {
                                "type": "linkMultiple",
                                "layoutDetailDisabled": true,
                                "layoutListDisabled": true,
                                "layoutMassUpdateDisabled": true,
                                "noLoad": true,
                                "importDisabled": true,
                                "isCustom": true
                            },
                            "nextTask": {
                                "type": "link"
                            }
                        },
                        "links": {
                            "tasksChildren": {
                                "type": "hasMany",
                                "foreign": "nextTask",
                                "entity": "Task",
                                "audited": false,
                                "isCustom": true
                            },
                            "nextTask": {
                                "type": "belongsTo",
                                "foreign": "tasksChildren",
                                "entity": "Task",
                                "audited": false,
                                "isCustom": true
                            }
                        }
                    }

                    Comment

                    • gundogduyakici
                      Senior Member
                      • Mar 2018
                      • 165

                      #11
                      I want Career Steps data to come in prevCareerSteps and nextCareerSteps while I am in the Career Steps area.
                      Is this the code you are going to do this? Right ?

                      Comment

                      • tanya
                        Senior Member
                        • Jun 2014
                        • 4308

                        #12
                        This code (fields and rels definition) allows you to link one task to other task

                        Comment

                        • gundogduyakici
                          Senior Member
                          • Mar 2018
                          • 165

                          #13
                          OK I did it. Thank you so much. You're awesome tanya

                          Comment

                          Working...