mcspronko / magento2-blog-module

Blog extension for Magento 2
10 stars 2 forks source link

how to join 2 table in magento 2 to display out grid listing #1

Open ducquy23 opened 1 year ago

mcspronko commented 1 year ago

Hi, can you give me an example of the second table and the grid columns?

ducquy23 commented 1 year ago

I have table in database: (Table name: ecommage_blogs (id (pk), title, author_id (a.k.a customer_id), url_key, content, created_at, updated_at, status - 1: publish, 2: draft, 3: non-publish), Now I want to join to the customer_entity table to get the email displayed on the grid listing,I have a reference in some documents, they say just add the _initSelect() method in the Collection.php file and join the table to join and go to the grid listing to see the results. <?php namespace Ecommage\Blogext3\Model\ResourceModel\Blog;

class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection { protected $_idFieldName = 'id'; protected $_eventPrefix = 'ecommage_blogs_collection'; protected $_eventObject = 'blogs_collection'; /**

mcspronko commented 1 year ago

Sorry, but your question is not related to the repository source code where you ask the question.