GithubHelp home page GithubHelp logo

internetztube / craft-element-relations Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 5.0 9.32 MB

Shows all relations of an element.

Home Page: https://plugins.craftcms.com/element-relations

License: Other

PHP 93.88% Twig 6.12%
craft-plugin craftcms

craft-element-relations's Introduction

craft-element-relations's People

Contributors

gbowne-quickbase avatar internetztube avatar sfsmfc avatar

Stargazers

 avatar  avatar

Watchers

 avatar

craft-element-relations's Issues

No jobs are run in production, dev very slow

Hi!

I'm struggling to get anywhere with this plugin unfortunately. While I can get the jobs to create, none of them are actually run even though all other jobs run as normal.

I reduced the bulk job size down to 1 but all of them remain at 0% progress.

When viewing an individual entry, the element relations field never seems to update: I just see a spinner.

Development does run, but extremely slowly.

Any ideas on how I can debug?

CleanShot 2022-03-12 at 21 14 53@2x

ElementRelations breaks LinkVault plugin

When using ElementRelations with LinkVault it breaks the plugin. If I disabled ElementRelations plugin then LinkVault works.

In the logs I see the following:

2022-11-24 08:12:15 [web.INFO] [yii\db\Connection::open] Opening DB connection: mysql:host=127.0.0.1;dbname=cr_site;port=3306 {"memory":4632416} 
2022-11-24 08:12:15 [web.INFO] [nystudio107\codeeditor\CodeEditor::bootstrap] CodeEditor module bootstrapped {"memory":7262344} 
2022-11-24 08:12:15 [web.INFO] [modules\site\Site::init] Site module loaded {"memory":7278592} 
2022-11-24 08:12:15 [web.INFO] [presseddigital\linkit\Linkit::init] Linkit plugin loaded {"memory":7785544} 
2022-11-24 08:12:15 [web.INFO] [vaersaagod\matrixmate\MatrixMate::init] MatrixMate plugin loaded {"memory":7878728} 
2022-11-24 08:12:15 [web.INFO] [wrav\oembed\Oembed::init] oEmbed plugin loaded {"memory":7916016} 
2022-11-24 08:12:15 [web.INFO] [nystudio107\retour\Retour::init] Retour plugin loaded {"memory":7977416} 
2022-11-24 08:12:15 [web.INFO] [nystudio107\seomatic\Seomatic::init] SEOmatic plugin loaded {"memory":8354632} 
2022-11-24 08:12:15 [web.INFO] [yii\web\Session::open] Session started {"memory":8450208} 
2022-11-24 08:12:15 [web.ERROR] [yii\base\ErrorException:2] yii\base\ErrorException: Attempt to read property "id" on null in /site/vendor/internetztube/craft-element-relations/src/ElementRelations.php:97
Stack trace:
#0 /sitevendor/craftcms/cms/src/web/ErrorHandler.php(79): yii\base\ErrorHandler->handleError(2, 'Attempt to read...', '/site/D...', 97)
#1 /site/vendor/internetztube/craft-element-relations/src/ElementRelations.php(97): craft\web\ErrorHandler->handleError(2, 'Attempt to read...', '/site/D...', 97)
#2 [internal function]: internetztube\elementRelations\ElementRelations->internetztube\elementRelations\{closure}(Object(craft\events\Model

So somehow ElementRelations is triggered there while trying download a file.

Craft version: 4.3.3
Plugin version: 2.0.2
LinkVault version: 4.0.1

Relations field breaking admin on multisite

PHP version | 8.2.0
Craft edition & version | Craft Pro 4.7.0
Asset Usage | 3.2.0

In a Craft multisite install, occasionally entries in the admin will get an error when trying to render the data from the Relations field type when present. It doesn't happen all the time, but when it does it breaks the entry editing and page formatting heavily.

Error: Call to a member function setTimezone() on bool in /home/forge/rogc.websitepreview.dev/vendor/internetztube/craft-element-relations/src/controllers/ElementRelationsController.php:29 Stack trace: #0 [internal function]: internetztube\elementRelations\controllers\ElementRelationsController->actionGetByElementId() #1 /home/forge/rogc.websitepreview.dev/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array() #2 /home/forge/rogc.websitepreview.dev/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams() #3 /home/forge/rogc.websitepreview.dev/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction() #4 /home/forge/rogc.websitepreview.dev/vendor/craftcms/cms/src/web/Application.php(305): yii\base\Module->runAction() #5 /home/forge/rogc.websitepreview.dev/vendor/craftcms/cms/src/web/Application.php(606): craft\web\Application->runAction() #6 /home/forge/rogc.websitepreview.dev/vendor/craftcms/cms/src/web/Application.php(284): craft\web\Application->_processActionRequest() #7 /home/forge/rogc.websitepreview.dev/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest() #8 /home/forge/rogc.websitepreview.dev/web/index.php(12): yii\base\Application->run() #9 {main}

Screen Shot 2024-01-25 at 10 57 08 AM

[beta] Unable to create new entries on Craft 4 multi-site

With Element Relations 2.0.0 beta installed on a Craft 4 multi-site install, I'm unable to create new entries by clicking the "New Entry" button in the main entries view. I'm getting the following in phperrors.log when I try:

PHP Fatal error:  Type of internetztube\elementRelations\jobs\EventElementAfterSaveJob::$description must be ?string (as in class craft\queue\BaseJob) in /Users/me/Documents/myproject/vendor/internetztube/craft-element-relations/src/jobs/EventElementAfterSaveJob.php on line 10

Craft version: 4.0.3
Element Relations 2.0.0-beta.2

Allow illuminate/collections ^9.0 support

Currently the plugin can't be installed on PHP 8 because of the composer requirement for illuminate/collections -- adding ^9.0 as a possibility will fix the problem.

FR: Table view

Maybe it's a good idea to show the Relations as a Table with more information like:

Title
Related Site
Section or Volume or Product Type
Element Type (Asset, Entry, etc.)
Related field (on which field is this relation)

Maybe this gives a bit more info/context when you search for something special.

Bug: Unable to save my profile settings due to undefined $job variable

Steps to reproduce:

Make a change to your own user preferences and click save.

What I expect:

Preferences should be saved

What happens:

An exception is thrown

yii\base\ErrorException: Undefined variable $job in /app/vendor/internetztube/craft-element-relations/src/ElementRelations.php:83
Stack trace:
#0 {main}

The issue is that the plugin is trying to push a variable $job to the queue, but $job hasn't been defined.

System details

PHP version 8.1 (also present with 7.4.26)
Craft Pro 3.7.39
Element Relations 1.3.5

FR: Plugin does not track relations in draft

Hey, the plugin seems to ignore elements that are linked within drafts.

We are using this plugin so we can see if an asset is linked in any entry before we delete it.

Now if an asset is linked in an unpublished draft, it still shows the asset is "unused", which is problematic because it is in fact used and should not be deleted.

Do you think you can change this, so relations in drafts get checked as well?

Craft 3.7.46
craft-element-relations: 1.3.7

Craft 5 Support

Any plans to get Element Relations updated for Craft 5 soon?

Postgres Issue when an element has a lot of relations.

SQLSTATE[54000]: Program limit exceeded: 7 ERROR: index row size 3248 exceeds maximum 2712 for index "idx_ncqxrcfezowfzzbexzbizkgivjmmyonsselc" HINT: Values larger than 1/3 of a buffer page cannot be indexed. Consider a function index of an MD5 hash of the value, or use full text indexing. The SQL being executed was: UPDATE "elementrelations" SET "relations"='|elements-start-

Plugin seems to slow down the assets pages

We've noticed searches and asset list pages seem a lot slower now that we've got the plugin running. We've got probably over a thousand images in a bunch of folders. Does your plugin cache the data once it looks up the relations? I know caching is one of the big issues in programming, but wonder if it could be stored until the asset is selected, viewed, edited? Just an idea

Bug: Create Refresh Element Relations Cache Jobs fails

Steps to reproduce:

  1. Go to Utilities > Element Relations
  2. Click Push Cache Refresh Job Into Queue button

What I expect:

The cache should rebuild in the background using the queue.

What happens:

Failed queue job with the following error message

Error | Argument 1 passed to internetztube\elementRelations\jobs\CreateRefreshElementRelationsJobsJob::internetztube\elementRelations\jobs{closure}() must be an instance of Tightenco\Collect\Support\Collection, instance of Illuminate\Support\Collection given, called in /home/forge/[projectname]/vendor/illuminate/collections/Traits/EnumeratesValues.php on line 242

System details

PHP version 7.4.26
Linux 5.4.0-88-generic
MySQL 5.5.5
Craft Pro 3.7.27.2
Element Relations 1.2.6

Other notes

Currently 21.77% of all elements, which have an Elements Relations-Field in their field layout, are cached.
In absolute terms this means 539 out of 2476 elements are cached.

FR: Add warning for Entry with relations when deleting or unpublishing. (changing status)

I have run into a specific scenario, when entry is in use, it shouldn't be unpublished (or deleted).
I have installed this plugin, so editors can check, if there are related entries. ANd they are informed that they should not unpublish such entries. It works until they don't forgot.

Feature request: when ElementRelations field shows entry's relations, changing entry's status (or deleting) would show a warning to the editor? Or maybe dissallow these operations? Is there any chance for such functionality?

Element Relations task gets stuck in queue until CP page refreshed

Description

This is kind of a weird one, and I haven't been able to produce super consistent repro steps, but as I'm working on a site build it seems almost every time I leave the tab I have my CP in, move over to a different browser tab, and come back to the CP later, there's an Element Relations task stuck in the queue until I either reload the page or click on the item going directly to the queue, then it quickly runs and goes away.

Screen Shot 2022-06-30 at 3 01 40 PM

I would be tempted to think this is a strange Craft bug, but it doesn't happen with any other plugins/tasks I've noticed. And more often than not, whenever I log into the CP of a site with this plugin installed, Element Relations tasks are running and quickly resolve once I load the CP. Like they are for some reason unable to run properly in the background/without a control panel load to trigger them to complete.

Does this make any sense? It's kind of a tricky one to describe/narrow down, but only seems to happen with this plugin.

Additional Information

Craft CMS: v4.1.0.2
Element Relations: v2.0.0

Failed update 1.0.6 => 1.2.3

Migration fails when upgrading from 1.0.6 to 1.2.3. Running Craft Pro 3.7.30.1

`Database Exception: SQLSTATE[HY000]: General error: 1828 Cannot drop column 'siteId': needed in a foreign key constraint 'fk_hsuqnkfyhtjzftcimobzwkwtwqutqrjuloos'
The SQL being executed was: ALTER TABLE elementrelations DROP COLUMN siteId

Migration: internetztube\elementRelations\migrations\m220104_164702_simplify_cache_strategy

Output:

drop column siteId from table {{%elementrelations}} ...Exception: SQLSTATE[HY000]: General error: 1828 Cannot drop column 'siteId': needed in a foreign key constraint 'fk_hsuqnkfyhtjzftcimobzwkwtwqutqrjuloos'
The SQL being executed was: ALTER TABLE elementrelations DROP COLUMN siteId (vendor/yiisoft/yii2/db/Schema.php:676)
#0 vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException(Object(PDOException), 'ALTER TABLE el...')
#1 vendor/yiisoft/yii2/db/Command.php(1102): yii\db\Command->internalExecute('ALTER TABLE el...')
#2 vendor/yiisoft/yii2/db/Migration.php(392): yii\db\Command->execute()
#3 vendor/internetztube/craft-element-relations/src/migrations/m220104_164702_simplify_cache_strategy.php(13): yii\db\Migration->dropColumn('{{%elementrelat...', 'siteId')
#4 vendor/craftcms/cms/src/db/Migration.php(52): internetztube\elementRelations\migrations\m220104_164702_simplify_cache_strategy->safeUp()
#5 vendor/craftcms/cms/src/db/MigrationManager.php(232): craft\db\Migration->up(true)
#6 vendor/craftcms/cms/src/db/MigrationManager.php(148): craft\db\MigrationManager->migrateUp(Object(internetztube\elementRelations\migrations\m220104_164702_simplify_cache_strategy))
#7 vendor/craftcms/cms/src/services/Updates.php(250): craft\db\MigrationManager->up()
#8 vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(532): craft\services\Updates->runMigrations(Array)
#9 vendor/craftcms/cms/src/controllers/UpdaterController.php(201): craft\controllers\BaseUpdaterController->runMigrations(Array, 'restore-db')
#10 [internal function]: craft\controllers\UpdaterController->actionMigrate()
#11 vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#12 vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#13 vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('migrate', Array)
#14 vendor/craftcms/cms/src/web/Application.php(287): yii\base\Module->runAction('updater/migrate', Array)
#15 vendor/craftcms/cms/src/web/Application.php(684): craft\web\Application->runAction('updater/migrate')
#16 vendor/craftcms/cms/src/web/Application.php(244): craft\web\Application->_processUpdateLogic(Object(craft\web\Request))
#17 vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#18 web/index.php(22): yii\base\Application->run()
#19 {main}`

Database error when installing and using plugin

We followed your directions to install the Elements Relations plugins and added the Relations field to our Assets sub-folder. Once I added the field to the subfolder in Assets, I viewed the Assets page and received an error pictured below. I also clicked into one of the Assets and the error appears on that page as well.

Here is where I added the relations field:
Screen Shot 2021-11-12 at 2 20 00 PM

This is the view when I open the Assets folder:
Screen Shot 2021-11-12 at 2 31 02 PM

getElementRelationsCached() TypeError

Hi - I'm getting lots of errors as per the following:

TypeError: internetztube\elementRelations\services\CacheService::getElementRelationsCached(): Argument #1 ($elementId) must be of type int, null given, called in /srv/app/*******/htdocs/vendor/internetztube/craft-element-relations/src/controllers/ElementRelationsController.php on line 23 and defined in /srv/app/mobkitchen-prod/htdocs/vendor/internetztube/craft-element-relations/src/services/CacheService.php:24
Stack trace:
#0 /srv/app/*******/htdocs/vendor/internetztube/craft-element-relations/src/controllers/ElementRelationsController.php(23):

Any ideas what might cause it, or do you need more details from me?

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.