Error: Call to a member function getConfigDependencyName() on null in
Drupal\flag\Plugin\views\relationship\FlagViewsRelationship->calculateDependencies() (line 170 of
/var/www/html/My_project

Whenever i used flag in "fields" or "Sort Criteria" or "Relationships",getting this error. I have used all patches related to similar type of this issue,but all are not working. If any one has solution of this ,please comment here .

Thanks in Advance

Comments

Sana.Neyazi created an issue. See original summary.

Sana.Neyazi’s picture

Assigned: Unassigned » Sana.Neyazi
hsponner’s picture

I have the same issue, even with 4.x-dev

tr’s picture

Version: 8.x-4.0-alpha3 » 8.x-4.x-dev
Assigned: Sana.Neyazi » Unassigned
Priority: Critical » Major
Issue tags: -Flag issue on view drupal8
thib’s picture

Hi,
I get the same issue :

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getConfigDependencyName() on null in Drupal\flag\Plugin\views\relationship\FlagViewsRelationship->calculateDependencies() (line 170 of modules/flag/src/Plugin/views/relationship/FlagViewsRelationship.php).

Thanks

ptmkenny’s picture

Title: Flag issue on view drupal8 » Flag in Views: Call to a member function getConfigDependencyName() on null
Status: Active » Postponed (maintainer needs more info)

Can you provide specific steps for reproducing this error from a clean install of Drupal 8? How was the flag created? How was the view set up?

thib’s picture

Ok,

Step to reproduce :
--------------------
- Create a flag type "Like content" -> Flaggable types "Photos Album"

- Create a content type "Photos Album"
-- Manage fields: field type reference to media (image) "Photo"
-- Manage display: disable all fields

- Create some content of type "Photos Album"

- Create block view "Photos Gallery" with these settings :
-- FORMAT
--- Format: Unformatted list
--- Show: Fields
-- FIELDS
--- Content: Photo
---- Formatter -> any other formatter than "Rendered entity"
-- FILTER CRITERIA
--- Content Published (=Yes)
--- Content Content type (=Photos Album)
-- PAGER
--- Use pager: Display all items
-- CONTEXTUAL FILTER
--- Content: ID
---- When the filter value is NOT available -> Provide default value -> Content ID from URL
-- RELATIONSHIP
--- Content Flag
---- Uncheck "Include only flagged content"
---- Flag -> Check "Like content"
-- FIELDS
--- Content: Flag link -> Relationship : Flags
--------------------

ptmkenny’s picture

Status: Postponed (maintainer needs more info) » Active

Thanks for updating with detailed info!

anthonylindsay’s picture

Having encountered this issue, I think I have a solution:

  1. Create the initial draft of your view without reference to any flags
  2. Save it
  3. Set up your flag and save it
  4. Add the relationship to views
  5. Save it
  6. Add your fields and filters to views
  7. Save it

Seems to be working so far.

gmaximus’s picture

This happened to me on a view that I'd already done a huge amount of work on. Inc templates. I edited the view and added relationships to flags that restricted the content. Hit this error, even when removing those relationships, I still couldn't successfully save.

Found this post and wasn't in a rush to rebuild the view. So I hit cancel on the view. Edited the view again and re-done the changes. Then it worked. No idea why but try it if you haven't. Damage limitation really. Fingers crossed.

katekarpenko’s picture

#10 and #9 in their combination worked for me great, thanks!

deaom’s picture

Version: 8.x-4.x-dev » 5.x-dev
Priority: Major » Normal

Not sure if something changed with the 5.x version and Flag relationship, but could not reproduce following the steps from comment #7 and using 5.x dev.

ivnish’s picture

Status: Active » Closed (cannot reproduce)

I tested this manually using steps to reproduce from comment #7. I don't see any errors. Closing this as "cannot reproduce'

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.