Well it’s a long time since I last postet something here. Sadly i’ve been very busy with work and afterwards just coded for about an hour before going to sleep.

So what’s going on you might ask. Ive startet a rewrite of an unfinished project called AMVScore back then. The project startet because a friend of mine who hosts the AMV Contest and at some allowed the people watching in the big concert hall to vote for the vid via Twitter. This became quite popular and it became quite much a pain (at least that’s what you might guess when you speak to him) to count all those votes. After the last convention I simply told him I will write him a tool which will pull the tweets from twitter and processes them. I hacked something together in about 3 days after the convention which would work well enough but never got to a stage where I really would count on it since I always wanted to rewrite it in Yii2 for a learning purpose. So i posponed the developement until a final release of my favorite php framework. And here it is. It’s now called TwitterContestScore since it can be used for any kind of voting contest on Twitter. It’s nowhere near finished since I’m developing this on a more or less daily basis after work, but I will most definitely finish it until before the next convention.

Because this whole thing is a yii2 learning project for me I will try to post „nice to know“ bits and pieces and I hope you will like it.

 

Tjahaaa einfaches Ding aber ich hab lange gesucht bis ich die Lösung hatte. Im nachhineine betrachtet ist das super simpel!

Ich hab in meinem aktuellen Projekt eine Recht perverse HasMany Struktur und musste bei der Ausgabe alle Relationen auflösen und diese teilweise in GridViews anzeigen.

Ich Meine Damit sowas Model1 -> has One Model2 -> Has Many Model 3 -> Has Many Model 4

Die beiden Has Many sind jeweils über Join Tables realisiert.

am ende hatte ich dann ein Kontrukt wie

(vereinfacht)

foreach($model->model2->relationsModel3 as $relation)

-> renderpartial(…. $relation);

 

im renderpartial dann das entsprechende Gridview für die relation zum Model 4

 

Da unsere Relation ein Array ist können wir den CArrayDataProvider von Yii nutzen und ihn damit füttern sodass wir die Relation als dataProvider des GridViews nutzen können

Funzt 1a und ist echt einfach!

 

greez Frank