Preview:
    $cnpp = cnplanpriceTable::getOneByPlan('A_PP_FREE1');

    $ads = cnadTable::getInstance()
      ->createQuery()
      ->andWhere('userid = ?', 1107924)
      ->andWhere('hw_pay_plan LIKE ?', '%A_PA_FREE1%')
      ->execute([], Doctrine::HYDRATE_ON_DEMAND);
    $this->log('Found ' . count($ads) . ' ads');

    foreach ( $ads as $cnad )
    {
      $cnad->setPlan($cnpp);
      $cnad->save();

      $cnexp = cnexpirationTable::getItem($cnad, 'ad_plan');
      $cnexp->setValue('A_PP_FREE1');
      $cnexp->save();
      $this->log('Processed ' . $cnad->getLinkId());
    }
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter