Rendering Data in Yii 2 with GridView and ListView
In my previous article about Yii 2.0, I introduced the ActiveRecord implementation. Once you have some data in your database you’ll want to be able to show it. Yii uses DataProviders to interact with data sources and it provides some widgets to output the data. Of these, the ListView and GridView provide the most functionality. The example I’m going to work with the database example that I introduced in my previous article again. Not very original, but quite useful as an example; a blog like SitePoint. A small wrap-up of this database design and its Yii models which I’ll be using in this example: The Authors model has one relation method call getArticles() that provides an Articles[] attribute to the model. The Articles model has one relation method call getAuthor() that provides the Author and a method getTags() that provides the Tags[] . The Tags model has one relation method call getArticles that provides Articles[] . I won’t be using the ArticlesTags ta...