当前位置: 首页>>代码示例>>PHP>>正文


PHP ZMObject::set方法代码示例

本文整理汇总了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());
 }
开发者ID:zenmagick,项目名称:zenmagick,代码行数:11,代码来源:ZMObjectTest.php

示例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;
 }
开发者ID:zenmagick,项目名称:zenmagick,代码行数:14,代码来源:SubscriptionRequestController.php

示例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);
 }
开发者ID:zenmagick,项目名称:zenmagick,代码行数:21,代码来源:BeansTest.php

示例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');
 }
开发者ID:zenmagick,项目名称:zenmagick,代码行数:20,代码来源:CouponService.php


注:本文中的ZenMagick\Base\ZMObject::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。