. */ /* */ /**********************************************************************************/ namespace Thelia\Model; use Thelia\Coupon\CouponRuleCollection; use Thelia\Model\Base\Coupon as BaseCoupon; /** * Created by JetBrains PhpStorm. * Date: 8/19/13 * Time: 3:24 PM * * Used to provide an effect (mostly a discount) * at the end of the Customer checkout tunnel * It will be usable for a Customer only if it matches the Coupon criteria (Rules) * * @package Coupon * @author Guillaume MOREL * */ class Coupon extends BaseCoupon { /** * Set the value of [serialized_rules] column. * * @param CouponRuleCollection $rules A set of Rules * * @return \Thelia\Model\Coupon The current object (for fluent API support) */ public function setSerializedRules(CouponRuleCollection $rules) { if ($rules !== null) { $v = (string) base64_encode(serialize($rules)); } if ($this->serialized_rules !== $v) { $this->serialized_rules = $v; $this->modifiedColumns[] = CouponTableMap::SERIALIZED_RULES; } return $this; } // setSerializedRules() /** * Get the [serialized_rules] column value. * * @return CouponRuleCollection Rules ready to be processed */ public function getSerializedRules() { return unserialize(base64_decode($this->serialized_rules)); } }