Giter VIP home page Giter VIP logo

many-to-many's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

many-to-many's Issues

A channel that shares info with other pages

I am using the Many to Many plugin and wondering if the below is possible.

I have a channel called Model ID. Model ID is then related to two other sections, Memory and SSD. I want to be able to link entries from Memory to entries in SSD via the Many To Many Field within Model ID.

Below is a picture, edited, to show the field layout and the information I have within the Model ID entry. The information within the entry is what I need to pull in to my Memory and SSD section but can not figure it out.

I feel like I am missing something very simple that might not be in the read me document for the plugin.

Here is a link to the question [on StackExchange]
(https://craftcms.stackexchange.com/questions/26696/many-to-many-plugin-template-help
many-to-many
)

Thanks for your help!

Namespace wrong

Seems like "use Craft\base\Field;" should be "use craft\base\Field;" where craft is with small letters. Causing class not found error.

GraphQL QueryArgument ":notempty:" not working for many-to-many field

Describe the bug

We have two sections: Organisation Entries and Job Entries. Each Job Entry has a "organisation" relationship field that selects one organisation. In the organisation entry itself we added a many-to-many relationship field called "relatedJobs".

There is no way to filter the organisation entries to only show organisations where the relatedJobs is not empty.
Testing this with the built-in relationship field on the job entries this is working without an issue.

Steps to reproduce

  1. create two section types
  2. add on relationship field and one many-to-many relationship field on the entries
  3. query for both with queryargument ":notempty:"
query GetOrganisationsWithJobOffers {
  organisationsEntries(relatedJobs: ":notempty:") {
    ... on EntryInterface {
      title
    }
    ... on organisations_organisation_Entry {
      relatedJobs {
        title
      }
    }
  }
  allOrgEntries: organisationsEntries {
    ... on EntryInterface {
      title
    }
    ... on organisations_organisation_Entry {
      relatedJobs {
        title
      }
    }
  }
  jobsEntries(organisation: ":notempty:") {
    ... on jobs_jobOffer_Entry {
      title
      organisation {
        title
      }
    }
  }
}

Result:

{
  "data": {
    "organisationsEntries": [],
    "allOrgEntries": [
      {
        "title": "Some Organisation",
        "relatedJobs": [
          {
            "title": "Some Job Offer"
          }
        ]
      },
      {
        "title": "Some Other Organisation",
        "relatedJobs": []
      }
    ],
    "jobsEntries": [
      {
        "title": "Some Job Offer",
        "organisation": [
          {
            "title": "Some Organisation"
          }
        ]
      }
    ]
  }
}

Craft CMS version

4.5.6.1

Plugin version

3.0.4

Multi-site?

No

Additional context

No response

Adding entries blank screen

When editing an entry, and clicking the "add entry" button. The modal body table is empty.

I only have this problem when using relations where the section of the original field and the section of the manytomany field are the same section.

When I use the same field between different sections, the field works as intended.

Argument 1 passed to craft\elements\db\ElementQuery::enabledForSite() must be of the type bool, null given

As of Craft CMS v3.4.6.1 while using the current version of the plugin available through this repo, I am seeing an error returned when attempting to add an entry to a Many to Many field.

Failed to load resource: the server responded with a status of 500 (Internal Server Error)
/index.php?p=admin/actions/element-indexes/get-elements&v=1582172064925:1
error: "Argument 1 passed to craft\elements\db\ElementQuery::enabledForSite() must be of the type bool, null given, called in ~/vendor/craftcms/cms/src/elements/db/ElementQuery.php on line 516"

Application Info
PHP version 7.3.14
OS version Linux 3.10.0-957.27.2.el7.x86_64
Database driver & version MySQL 5.7.29
Image driver & version GD 7.3.14
Craft edition & version Craft Pro 3.4.6.1

Feature request: customize "Add an entry" text

With a normal Entry field, you can customize the "Add an entry" text. It would be great to do that with Many to Many fields as well.

For example, here I would like to change the text to say "Add a room".
screen shot 2019-03-05 at 11 10 57 am

How to eager load a many-to-many relation?

I've a many-to-many relation set up. I've tried two approaches to work with eager loading, but can't figure it out.

  1. This approach works, but not sure how I can apply eager loading for this:
craft.entries.section('relatedSection').relatedTo(entry).all()
// Result ok but doesn't pair with eager loading
  1. But have trouble with this one, while this might support eager loading:
entry.relatedSectionFieldName
// Result empty

For the regular relation, this last approach does work.

Tag new release

Hi, this modal window issue #24 has been fixed via PR #28 since middle 2019, but is not available through composer or on the Plugin Store. Can someone please tag a new release so that it gets updated? Thanks!

Many texts are not translatable

Hi,

I want to translate this plugin to dutch, but many of the text strings you're using are not going through the translate filter. For example: "Add an entry" is always in english. Can this be fixed?

Would be great to let us select Commerce product types

I really like the idea of this field type, but it would be great to let us use it with Commerce Product. I'm adding Categories to my products and would like to see all of the associated products when I go see my Categories entry page.

Many to Many field is null in entry object

I'm perplexed!

I have a many to many relationship where one side is an Entries Subset field and the other is Many to Many. The relationship is between two entries in the same structure (different entry types).

Everything works perfectly in the CP. When templating, however, I can access the entries subset field, but the Many to Many field returns null.

Setup

  • Craft Pro 3.2.8
  • Postgres
  • Many to Many - linking to master branch of this repo
  • Entries Subset 1.2.1

Adding and removing relations doesn't work.

Describe the bug

The field shows the correct linked entries. But adding or removing relations, do not save.

Steps to reproduce

  1. Adding relations in section 1 to section 2 as normal.
  2. Editing relations in the many-to-many field in section 2.

Craft CMS version

4.3.10

Plugin version

3.0.2

Multi-site?

No

Additional context

No response

Relate entries of same type?

Is there any way to relate entries of the same type to each other? For example, a channel of 'person' might have a 'spouse' field where you choose another person to relate. It'd be great if you could use this plugin to set up the two-way relationship but currently it only works across entry types.

Great work though, really useful!

Anyway to set a Many To Many field in a plugin?

I've tried to use $entry->setFieldValue('manyToManyFieldName', $otherEntry->id); and then save the entry using the elements saveElement() method. However that doesn't seem to work. Is there something simple I'm missing here?

Incompatible after upgraded from Page8's plugin

Question

I assume that I wouldn't need to do anything after upgrading from Page 8's many to many plugin, but I got errors in the CP like this on all the many to many fields: Unable to find component class 'Page8\ManyToMany\fields\ManyToManyField'. I wonder what I did wrong.

I didn't run composer require verbb/many-to-many && composer remove page-8/craft-manytomany, but I remove page-8/craft-manytomany and specify "verbb/many-to-many": "2.0.0" in composer.json, and run composer install (without composer.lock) together with Craft & bunches of other plugins I want to update. I assume this is the same as running composer require and composer remove as you suggested.

It would be great if you can advise.

Additional context

PHP version 8.1.9
Craft edition & version Craft Pro 3.7.61

Adding entries does not work

#Deleting entries from the many-to-many field works, but adding them, I get a blank screen with no entries to select in Craft 3.5.17

Use arguments in GraphQL

Describe the bug

I can't seem to use arguments for the many-to-many field via GraphQL? The part (limit: 3) of the example query results in an error. Without

query example {
  entry: artistsEntries(slug: "jackson-michael") {
    ... on artists_artist_Entry {
      title
      summary
      tracks (limit: 3) {
        title
      }
    }
  }
}

Unknown argument "limit" on field "tracks" of type "artists_artist_Entry".

Steps to reproduce

  1. Setup Many-to-Many field (in this example tracks)
  2. Retrieve data via GraphQL, e.g.
query example {
  entry: artistsEntries(slug: "jackson-michael") {
    ... on artists_artist_Entry {
      title
      summary
      tracks {
        title
      }
    }
  }
}
  1. Confirm it works
  2. Add limit for many to many field:
query example {
  entry: artistsEntries(slug: "jackson-michael") {
    ... on artists_artist_Entry {
      title
      summary
      tracks {
        title
      }
    }
  }
}
  1. Error is thrown

Craft CMS version

4.5.6.1

Plugin version

dev-craft-4

Multi-site?

Yes

Additional context

No response

Max limit for associated field

Thanks for the plugin! It would be cool if while setting the second associated field we had an option to limit the maximum number of entries allowed. For example, I use it to associate journal publications with its print issues, and while one issue could have many publications, a publication could be related only to a single issue.

Can't select element to relate to from modal

Hi!

When trying to add a (reverse) relationship from a Many to Many field, the element select modal opens up empty (no elements to select from).

Probably because of changes introduces in Craft 3.1, ref: https://craftcms.com/guides/updating-plugins-for-craft-3-1#update-element-source-key-references

So it seems this is easily fixed by changing

'section' => $relatedSection->id

to

'section' => $relatedSection->uid

in craft-manytomany/src/fields/ManyToManyField.php> getInputHtml()

Thank you for providing a nice plugin!


Craft 3.1.15 with project.yaml

CP is inaccessible if the underlying fields aren't present

I was testing out the plugin so I created some dummy fields. I happened to name the fields in a way that the many-to-many field was last in the CP. When I deleted the other fields, the many-to-many ceased to work (as expected), but also was unable to be deleted.

Upon refreshing the page, I got a runtime error and was unable to access the CP, even at the highest level of the CP (/admin) that. I have since restored a backed up database, but the error was something like class manytomanyfield failed.

In this environment it was fine, but a check for that would be helpful, as would a disabled state where I could delete the field. If a user added that to a more important environment, it would have disabled everything and been unable to fix from the CP.

Edit: This was in Craft 3

Documentation could be a little clearer

New self-managing relationships are great, thank you!
It took me a little while to figure out that you've added some settings to manage this - I was looking all over in the many-to-many fieldtype for an "add button" and trying combinations of fields to get it working. Maybe mention that the options of which you speak are inside new plugin settings! That would save some other unsuspecting folk some time.

Thanks again

[craft-5] Parse error

Describe the bug

Hi again,

Have just encountered a small issue upgrading to Craft 5, looks like it'd just be the -> here and here

Screenshot 2024-03-06 at 5 17 14 pm

Steps to reproduce

  1. Upgrade to Craft 5 beta
  2. Attempt to access entry containing a Many to Many field

Craft CMS version

5.0.0-beta.6

Plugin version

4.0.0-beta.1

Multi-site?

No

Additional context

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.