class PostCategory extends ActiveRecord
{
	public static function tableName(): string
	{
		return '{{%post_category}}';
	}
	
	public function behaviors(): array
	{
		return [
			[
		 	'class' => TimestampBehavior::class,
				'attributes' => [
					ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'],
					ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
				],
			],
			[
			'class' => BlameableBehavior::class,
			],
			[
			'class' => SluggableBehavior::class,
				'attribute' => 'title',
				'slugAttribute' => 'slug',
				'immutable' => true,
				'ensureUnique' => true,
			],
		];
	}
	
	public function rules(): array
	{
		return [
			[['title'], 'required'],
			
			[['parent_id', 'created_by', 'updated_by', 'created_at', 'updated_at'], 'integer'],
			[['title', 'slug'], 'string', 'max' => 255],
			[['slug'], 'unique'],
			[['parent_id'], 'exist', 'skipOnError' => true, 'targetClass' => self::class, 'targetAttribute' => ['parent_id' => 'id']],
			[['created_by'], 'exist', 'skipOnError' => true, 'targetClass' => User::class, 'targetAttribute' => ['created_by' => 'id']],
			[['updated_by'], 'exist', 'skipOnError' => true, 'targetClass' => User::class, 'targetAttribute' => ['updated_by' => 'id']],
		];
	}
	
	public function attributeLabels(): array
	{
		return [
			'id' => \Yii::t('app', 'ID'),
			'title' => \Yii::t('app', 'Title'),
			'slug' => \Yii::t('app', 'Slug'),
			'parent_id' => \Yii::t('app', 'Parent ID'),
			'created_by' => \Yii::t('app', 'Created By'),
			'updated_by' => \Yii::t('app', 'Updated By'),
			'created_at' => \Yii::t('app', 'Created At'),
			'updated_at' => \Yii::t('app', 'Updated At'),
		];
	}
	
	public function getParent()//: \yii\db\ActiveQuery | app\models\query\PostCategoryQuery
	{
		return $this->hasOne(self::class, ['id' => 'parent_id']);
	}
	
	public function getChildren()//: \yii\db\ActiveQuery|PostCategoryQuery
	{
		return $this->hasMany(self::class, ['parent_id' => 'id']);
	}
	
	public function getSiblings()//: \yii\db\ActiveQuery|PostCategoryQuery
	{
		return self::find()
			->where(['parent_id' => $this->parent_id])
			->andWhere(['!=', 'id', $this->id])
			->all();
	}
	
	public static function findRoots()//: \yii\db\ActiveQuery|PostCategoryQuery
	{
		$roots = self::find()
			->where(['parent_id' => null])
			->all();
		
		\Yii::info(print_r($roots, true), __METHOD__);// Log the output for debugging.
		 
		 return $roots;
	}
	
	public function getPostCategories()//: \yii\db\ActiveQuery | app\models\query\PostCategoryQuery
	{
		return $this->hasMany(self::class, ['parent_id' => 'id']);
	}
	
	public function getPosts()//: \yii\db\ActiveQuery | app\models\query\PostQuery
	{
		return $this->hasMany(Post::class, ['category_id' => 'id']);
	}
	
	public function getCreatedBy()//: \yii\db\ActiveQuery | app\models\query\UserQuery
	{
		return $this->hasOne(User::class, ['id' => 'created_by']);
	}
	
	public function getUpdatedBy()//: \yii\db\ActiveQuery | app\models\query\UserQuery
	{
		return $this->hasOne(User::class, ['id' => 'updated_by']);
	}
}

PostCategory Controller:

	 public function actionIndex()
	 {
	 	$rootCategories = PostCategory::findRoots();
	 	$dataProvider = new ArrayDataProvider([
	 		'allModels' => $rootCategories,
	 		/*'pagination' => [
	 			'pageSize' => 10,// Set as needed.
	 		],
	 		'sort' => [
	 			'attributes' => ['title', 'created_at'],// Modify attributes as needed.
	 		],//*/
	 	]);
	 	
	 	return $this->render('index', [
	 		'dataProvider' => $dataProvider,
	 	]);
	 }

PostCategory View Index:

<?= GridView::widget([
	'dataProvider' => $dataProvider,
	'options' => ['class' => 'table-responsive grid-view admin-grid-view'],// This class affects the container div.
	'tableOptions' => ['class' => 'table table-striped table-bordered grid-view'],// Add bootstrap table classes.
	'layout' => '{summary} {items} {pager}',
	'columns' => [
		[
			'class' => 'yii\grid\ActionColumn',
			'header' => 'Action',
			'template' => '{view} {update} {delete}',
		],
	
not only does actionColumn not return the proper id, it start at zero for ids.. and is also not returning more than one PostCategory for gridView.