Example #1
0
 /**
  * Find all SEO data.
  * Result will be in format ['condition1'=>Seo(), 'condition2'=>Seo(), ...]
  * @param ActiveRecord $owner the model for which to find data
  * @return self[]
  */
 public static function findAll(ActiveRecord $owner)
 {
     /** @var self[] $seoList */
     $seoList = [];
     if ($owner->getIsNewRecord()) {
         return $seoList;
     }
     $query = (new Query())->from(Seo::tableName($owner))->andWhere(['model_id' => $owner->getPrimaryKey()]);
     foreach ($query->all($owner->getDb()) as $seo) {
         $seo = new Seo($seo);
         $seo->_isNewRecord = false;
         $seo->_owner = $owner;
         $seoList[$seo['condition']] = $seo;
     }
     return $seoList;
 }
 /**
  * Delete all SEO data
  */
 public function deleteAllSeobility()
 {
     Seo::deleteAll($this->owner);
 }