Exemplo n.º 1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getArtist()
 {
     return $this->hasOne(Artist::className(), ['id' => 'artist_id']);
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getArtists()
 {
     return $this->hasMany(Artist::className(), ['id' => 'artist_id'])->viaTable('artist_tag', ['tag_id' => 'id']);
 }
Exemplo n.º 3
0
    public function getTags()
    {
        return $this->hasMany(Tag::className(), ['id' => 'tag_id'])->viaTable('artist_tag', ['artist_id' => 'id']);
    }
    /**
     * @return \yii\db\ActiveQuery
     */
    public function getPhotos()
    {
        return $this->hasMany(Photo::className(), ['artist_id' => 'id']);
    }
    /**
     * @return \yii\db\ActiveQuery
     */
    public function getReleases()
    {
        return $this->hasMany(Release::className(), ['artist_id' => 'id']);
    }
    /**
     * @return string
     */
    public function getComname()
    {
        return Utils::mergeNames($this->original_name, $this->latin_name);
    }
}
Event::on(Artist::className(), Artist::EVENT_BEFORE_DELETE, function ($event) {
    foreach ($event->sender->photos as $item) {
        $item->delete();
    }
});
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getArtists()
 {
     return $this->hasMany(Artist::className(), ['user_id' => 'id']);
 }