How to access a published asset correctly

Hi,

I just want to check if I’m retrieving assets the ‘correct’ way:

I publish a non-accessible file, e.g.: /var/www/html/wer/picture.png


Yii::app()->getAssetManager()->publish('/var/www/html/wer/picture.png');

… and to retrieve the file I use:


$img = Yii::app()->getAssetManager()->getPublishedUrl('/var/www/html/wer/picture.png');

This works fine, but I’m wondering if this is the correct way to go?

Thanks

Why not combine these in one step?


$img=Yii::app()->getAssetManager()->publish('/var/www/html/wer/picture.png');

Ok! In the source code I now see that it returns already published assets too.

Thanks