I have a Product Category table, where I have stored categories if parent_id is null then assume this is parent category if not null then it has child categories. Now the issue is I can't show parent category name in listing page, so can someone have an idea how to make a relation in Product Category entity?
Symfony version: 3.3
Table Structure:(product_category)
id
parent_id
slug
title
I have tried this code in ProductCategory entity but it doesn't show any relational data:
class ProductCategory
{
/**
* @ORM\OneToMany(targetEntity="ProductCategory", mappedBy="parent")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", nullable=true)
*/
private $parent;