isNew(); $result = parent::save($con); if ($isNew && $this->getCategory()->hasChildren()) { $con = Propel::getConnection(); $con->executeQuery(sprintf("INSERT INTO %s (%s, %s, %s) SELECT %d, %s, %d FROM %s WHERE %s BETWEEN %d AND %d AND %s = %d", DiscountCouponCodeHasCategoryPeer::TABLE_NAME, DiscountCouponCodeHasCategoryPeer::DISCOUNT_COUPON_CODE_ID, DiscountCouponCodeHasCategoryPeer::CATEGORY_ID, DiscountCouponCodeHasCategoryPeer::IS_OPT, $this->getDiscountCouponCodeId(), CategoryPeer::ID, 1, CategoryPeer::TABLE_NAME, CategoryPeer::LFT, $this->getCategory()->getLft() + 1, $this->getCategory()->getRgt() - 1, CategoryPeer::SCOPE, $this->getCategory()->getScope() )); } return $result; } }