service/components/behaviors/StoreBehavior.php
/**
     * Opens storing content. If storing content exists it is returned otherwise new instance is created
     *
     * @return service\models\StoredContent
     */
Opens storing content. If storing content exists it is returned otherwise new instance is created
@return service\models\StoredContent
Opens storing content . If storing content exists it is returned otherwise new instance is created @return service \ models \ StoredContent
public function openStoredContent()
    {
        $link = $this->owner->getLink();
        if (null === ($storedContent = StoredContent::findByLink($link))) {
            $storedContent = new StoredContent();
            $storedContent->setScenario(StoredContent::SCENARIO_CREATE);
            $storedContent->name = $link->getContentName();
            $storedContent->size = $link->getContentSize();
            $storedContent->ext_url = $link->getLink();
            $storedContent->complete = 0;
            try {
                if (!$storedContent->save()) {
                    return null;
                }
            } catch (\Exception $e) {
                Yii::error($e);
                return null;
            }
        }
        return $storedContent;
    }
public function openStoredContent ( ) { $ link = $ this -> owner -> getLink ( ) ; if ( null === ( $ storedContent = StoredContent :: findByLink ( $ link ) ) ) { $ storedContent = new StoredContent ( ) ; $ storedContent -> setScenario ( StoredContent :: SCENARIO_CREATE ) ; $ storedContent -> name = $ link -> getContentName ( ) ; $ storedContent -> size = $ link -> getContentSize ( ) ; $ storedContent -> ext_url = $ link -> getLink ( ) ; $ storedContent -> complete = 0 ; try { if ( ! $ storedContent -> save ( ) ) { return null ; } } catch ( \ Exception $ e ) { Yii :: error ( $ e ) ; return null ; } } return $ storedContent ; }
Opens storing content.
Opens storing content .