No Code Attached Yet
avatar Gratia-Mira
Gratia-Mira
25 Dec 2021

Steps to reproduce the issue

Read in articles with the Table class, e.g. with the extension (Spreadsheet Data Uploader https://gitlab.com/Gratia-Mira/spreadsheet-data-uploader). Attention, this is an alpha variant!

Expected result

Die Artikel im Backend sehen!
Mit derselben Erweiterung funktioniert des mit den Kategorien.

Actual result

The articles are not displayed, although they are correctly in the database (as far as I can see).

System information (as much as possible)

mysql
10.4.19-MariaDB
PHP 7.4.20
Webserver Apache/2.4.48 (Win64) OpenSSL/1.1.1k PHP/7.4.20

Additional comments

Thank you for being able to look at the problem. It really seems like something Joomla 4 could improve on.
Otherwise, I would be happy to receive alternative suggestions to the Tabel class.

avatar Gratia-Mira Gratia-Mira - open - 25 Dec 2021
avatar joomla-cms-bot joomla-cms-bot - change - 25 Dec 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Dec 2021
avatar Gratia-Mira
Gratia-Mira - comment - 25 Dec 2021

I found the problem and wrote a workaround. This was not necessary with Joomla 3.

if($isNew == true) {

// get the ID of the article
$query = $this->db->getQuery(true);
$query->select($this->db->quoteName('id'));
$query->from($this->db->quoteName('#__content'));
$query->where($this->db->quoteName('title') . ' = ' . $this->db->quote($row->title));

$this->db->setQuery($query);

// Load the results as a list of stdClass objects
$results = $this->db->loadObjectList();

// define values
$ID = $results[0]->id;
$stageID = 1;
$extenstion = "'com_content.article'";

// makes an entry so that the article is visible in the backend
$query = $this->db->getQuery(true);

$colums = array('item_id','stage_id','extension');
$values = array($ID,$stageID,$extenstion);

$query	
	->insert('#__workflow_associations')
	->columns($colums)
	->values(implode(',',$values));

$this->db->setQuery($query);
$this->db->execute();
	 }
avatar brianteeman
brianteeman - comment - 25 Dec 2021

This was not necessary with Joomla 3.

and it should not be necessary in Joomla 4 if you are not using the workflows

avatar Gratia-Mira
Gratia-Mira - comment - 25 Dec 2021

ok, for me the articles were only displayed in the backend when I also used this table... and someone else had the same problem...
I don't use workflow or not consciously...

avatar brianteeman
brianteeman - comment - 25 Dec 2021

look at content created in joomla - that table is empty if you dont use workflows

avatar Gratia-Mira
Gratia-Mira - comment - 30 Dec 2021

Ok, that's right! Nevertheless, the articles are only displayed when I fill this table. And I really haven't activated workflow. It is a new Joomla 4 installation.
Could filling this database table have any negative consequences?

Thank you very much for your feedback!

avatar alexandreelise
alexandreelise - comment - 30 Dec 2021

@Gratia-Mira is right had the same problem. Solved it the same way.

avatar Gratia-Mira
Gratia-Mira - comment - 30 Dec 2021

@alexandreelise Thanks for your feedback!

avatar brianteeman
brianteeman - comment - 30 Dec 2021

There is definitely a bug/error somewhere

avatar roland-d
roland-d - comment - 2 Jan 2022

I hear people run into this all the time, that the workflow association table must be filled. We should check if workflow is active before joining the table. Agree it is a bug.

avatar brianteeman
brianteeman - comment - 2 Jan 2022

You should not have to write "workarounds". Its obviously a bug - write a fix.

avatar antonioaltamura
antonioaltamura - comment - 3 Jan 2022

I experienced the same problem. Updating workflow_associations make the articles appears in admin backend, yet not in frontend.
I've added via mysql:

  • 1 category "Category 1"
  • 3 articles, 1 in "Uncategorised "category and 2 in "Category1".

One article in "Uncategorised" has been added normally via admin backend.

This is the current state in frontend

Home page with "Categories" view
1


Uncategorised category view in which you can only see the article added via admin backend
2


Category1 category view
3

avatar brianteeman
brianteeman - comment - 3 Jan 2022

I've added via mysql:

What exactly was your query

avatar Gratia-Mira
Gratia-Mira - comment - 3 Jan 2022

You should not have to write "workarounds". Its obviously a bug - write a fix.

I'm sorry, I'm not in a position to do that. I only started learning php two years ago. Before that I was only a Joomla user. But I will do it if I ever get that far.

avatar brianteeman
brianteeman - comment - 3 Jan 2022

@Gratia-Mira @alexandreelise Please go into the database and tell me what the value of asset_id field is for the articles that do not appear in the admin. AND check the database and tell me if there is an entry in the _assets table with a matching id

avatar antonioaltamura
antonioaltamura - comment - 3 Jan 2022

@brianteeman the purpose of the script is to migrate articles and categories from j2.5 installation to a j4 one.
It is long but if you look at it is very simple
https://pastebin.com/EyBtaPgX

avatar brianteeman
brianteeman - comment - 3 Jan 2022

Please go into the database and tell me what the value of asset_id field is for the articles that do not appear in the admin. AND check the database and tell me if there is an entry in the _assets table with a matching id

avatar brianteeman
brianteeman - comment - 3 Jan 2022

I was wrong!!!

the workflows associations is created when the article is created

@bembelimen why is this happening if the workflows is not in use on the site?

avatar antonioaltamura
antonioaltamura - comment - 3 Jan 2022

@brianteeman as I said, after I read this ticket I manage to see the articles in backend (by adding entries in workflow_associations). Now the problem is the frontend. The articles I added are not there.
The asset_id FKs in content correctly match the entries in assets table.

avatar brianteeman
brianteeman - comment - 3 Jan 2022

Can you share one record from the content table that is not being displayed please. I can now replicate the admin issue when no workflow_association but they are displayed in the frontend so you must be missing something else

avatar Gratia-Mira
Gratia-Mira - comment - 3 Jan 2022

@Gratia-Mira @alexandreelise Please go into the database and tell me what the value of asset_id field is for the articles that do not appear in the admin. AND check the database and tell me if there is an entry in the _assets table with a matching id

Yes, there is a matching entry in the table assets!

avatar brianteeman
brianteeman - comment - 3 Jan 2022
avatar antonioaltamura
antonioaltamura - comment - 3 Jan 2022

@brianteeman

This is an entry in content table in json

{"id":"3","asset_id":"92","title":"article3 source","alias":"article3","introtext":"<p>article3<\/p>","fulltext":"","state":"1","catid":"8","created":"2021-12-31 21:37:35","created_by":"666","created_by_alias":"","modified":"2022-01-02 22:37:41","modified_by":"666","checked_out":null,"checked_out_time":null,"publish_up":"2022-01-02 22:37:49","publish_down":null,"images":"{\"image_intro\":\"\",\"image_intro_alt\":\"\",\"float_intro\":\"\",\"image_intro_caption\":\"\",\"image_fulltext\":\"\",\"image_fulltext_alt\":\"\",\"float_fulltext\":\"\",\"image_fulltext_caption\":\"\"}","urls":"{\"urla\":\"\",\"urlatext\":\"\",\"targeta\":\"\",\"urlb\":\"\",\"urlbtext\":\"\",\"targetb\":\"\",\"urlc\":\"\",\"urlctext\":\"\",\"targetc\":\"\"}","attribs":"{\"article_layout\":\"\",\"show_title\":\"\",\"link_titles\":\"\",\"show_tags\":\"\",\"show_intro\":\"\",\"info_block_position\":\"\",\"info_block_show_title\":\"\",\"show_category\":\"\",\"link_category\":\"\",\"show_parent_category\":\"\",\"link_parent_category\":\"\",\"show_author\":\"\",\"link_author\":\"\",\"show_create_date\":\"\",\"show_modify_date\":\"\",\"show_publish_date\":\"\",\"show_item_navigation\":\"\",\"show_hits\":\"\",\"show_noauth\":\"\",\"urls_position\":\"\",\"alternative_readmore\":\"\",\"article_page_title\":\"\",\"show_publishing_options\":\"\",\"show_article_options\":\"\",\"show_urls_images_backend\":\"\",\"show_urls_images_frontend\":\"\"}","version":"2","ordering":"0","metakey":"","metadesc":"","access":"1","hits":"0","metadata":"{\"robots\":\"\",\"author\":\"\",\"rights\":\"\"}","featured":"0","language":"*","note":""}

this is the related asset

{"id":"92","parent_id":"89","lft":"25","rgt":"26","level":"3","name":"com_content.article.3","title":"article3 source","rules":"{\"core.delete\":{\"6\":1},\"core.edit\":{\"6\":1,\"4\":1},\"core.edit.state\":{\"6\":1,\"5\":1}}"}

please tell me if you prefer a different format.

avatar alexandreelise
alexandreelise - comment - 3 Jan 2022

@brianteeman It's a long time ago. Maybe it has been fixed by then.

avatar bembelimen
bembelimen - comment - 3 Jan 2022

You always need a stage mapping, so your Joomla site does not crash if you enable the workflow.

You should use the article model to save articles not the table.

avatar brianteeman
brianteeman - comment - 3 Jan 2022

Thanks @bembelimen that should be the answer for everyone.

@antonioalamura your issue might be different, I will try to spend some time tomorrow

avatar antonioaltamura
antonioaltamura - comment - 3 Jan 2022

@brianteeman thanks.
If you want to test my code just use a fresh j2.5 installation (with a couple of articles added via backend) and a fresh j4 one.
The only params are on top of the script: these 2 arrays $source, $target, and db credentials.

avatar Gratia-Mira
Gratia-Mira - comment - 4 Jan 2022

Thank you all so much!

This was my first ticket. Am I responsible for closing it or should I leave it open?

avatar cdc929
cdc929 - comment - 7 Jan 2022

Hi, has this issue been resolved?
I'm having the same problem, any suggestion ?
Workflow is disabled in my J4.4 install

avatar brianteeman
brianteeman - comment - 7 Jan 2022

You always need a stage mapping, so your Joomla site does not crash if you enable the workflow.

You should use the article model to save articles not the table.

avatar Gratia-Mira Gratia-Mira - change - 26 Jan 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-01-26 20:40:34
Closed_By Gratia-Mira
avatar Gratia-Mira Gratia-Mira - close - 26 Jan 2022

Add a Comment

Login with GitHub to post a comment