本文整理汇总了PHP中ZenMagick\Base\ZMObject::set方法的典型用法代码示例。如果您正苦于以下问题:PHP ZMObject::set方法的具体用法?PHP ZMObject::set怎么用?PHP ZMObject::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZenMagick\Base\ZMObject
的用法示例。
在下文中一共展示了ZMObject::set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testProperties
/**
* Test properties.
*/
public function testProperties()
{
$obj = new ZMObject();
$obj->set('foo', 'bar');
$obj->set('deng', 'poh');
// custom only
$this->assertEquals(array('foo' => 'bar', 'deng' => 'poh'), $obj->getProperties());
}
示例2: createModel
/**
* Create the model from the current request.
*
* @return ZMObject The model.
*/
protected function createModel($parameterBag)
{
$model = new ZMObject();
$model->set('type', $parameterBag->get('type'));
$model->set('orderId', $parameterBag->get('orderId'));
$model->set('message', $parameterBag->get('message'));
$model->set('types', $this->getPlugin()->getRequestTypes());
return $model;
}
示例3: testObj2map
/**
* Test obj2map.
*/
public function testObj2map()
{
// get all properties
$expectAll = array('foo' => 'bar', 'doh' => 'nut', 'properties' => array('foo' => 'bar', 'doh' => 'nut'), 'propertyNames' => array('foo', 'doh'), 'attachedMethods' => array());
$obj = new ZMObject();
$obj->set('foo', 'bar');
$obj->set('doh', 'nut');
$map = Beans::obj2map($obj);
$this->assertEquals($expectAll, $map);
// get subset of properties
$expectSpecific = array('foo' => 'bar', 'doh' => 'nut');
$map = Beans::obj2map($obj, array_keys($expectSpecific));
$this->assertEquals($expectSpecific, $map);
// get subset of array
$arr = array_merge($expectSpecific, array('some' => 'other'));
$map = Beans::obj2map($arr, array_keys($expectSpecific));
$this->assertEquals($expectSpecific, $map);
}
示例4: finaliseCoupon
/**
* Finalise a coupon.
*
* @param int couponId The coupon id.
* @param int accountId The redeeming account id.
* @param string remoteIP The redeeming IP addres; default is an empty string.
*/
public function finaliseCoupon($couponId, $accountId, $remoteIP = '')
{
$tracker = new ZMObject();
$tracker->set('couponId', $couponId);
$tracker->set('accountId', $accountId);
$tracker->set('redeemDate', new \DateTime());
$tracker->set('redeemIp', $remoteIP);
$tracker->set('orderId', 0);
\ZMRuntime::getDatabase()->createModel('coupon_redeem_track', $tracker);
$sql = "UPDATE %table.coupons%\n SET coupon_active = :active\n WHERE coupon_id = :id";
$args = array('id' => $couponId, 'active' => Coupon::FLAG_WAITING);
\ZMRuntime::getDatabase()->updateObj($sql, $args, 'coupons');
}