/** * @internal * * @param \SimpleXMLElement $xml * * @return Shipper */ public static function fromXml(\SimpleXMLElement $xml) { $shipper = new Shipper(); $shipper->setIsResponse(); if (isset($xml->ShipperNumber)) { $shipper->setNumber($xml->ShipperNumber); } if (isset($xml->Address)) { $shipper->setAddress(InstructionalAddress::fromXml($xml->Address)); } return $shipper; }
public function testUnmarshalling() { $booksXml = <<<XML <?xml version="1.0"?> <purchase-order xmlns="http://openuri.org/easypo"> <customer> <name>Gladys Kravitz</name> <address>Anytown, PA</address> </customer> <date>2003-01-07T14:16:00-05:00</date> <line-item> <description>Burnham's Celestial Handbook, Vol 1</description> <per-unit-ounces>5</per-unit-ounces> <price>21.79</price> <quantity>2</quantity> </line-item> <line-item> <description>Burnham's Celestial Handbook, Vol 2</description> <per-unit-ounces>5</per-unit-ounces> <price>19.89</price> <quantity>2</quantity> </line-item> <shipper> <name>ZipShip</name> <per-ounce-rate>0.74</per-ounce-rate> </shipper> </purchase-order> XML; $filepath = dirname(__FILE__) . '/../../_files/EasyPO/'; $binding = new PiBX_Runtime_Binding($filepath . '/binding.xml'); $unmarshaller = new PiBX_Runtime_Unmarshaller($binding); $po = new PurchaseOrder(); $po->setDate('2003-01-07T14:16:00-05:00'); $customer = new Customer(); $customer->setName('Gladys Kravitz'); $customer->setAddress('Anytown, PA'); $lineItem1 = new LineItem(); $lineItem1->setDescription('Burnham\'s Celestial Handbook, Vol 1'); $lineItem1->setPerUnitOunces('5'); $lineItem1->setPrice(21.79); $lineItem1->setQuantity(2); $lineItem2 = new LineItem(); $lineItem2->setDescription('Burnham\'s Celestial Handbook, Vol 2'); $lineItem2->setPerUnitOunces('5'); $lineItem2->setPrice(19.89); $lineItem2->setQuantity(2); $shipper = new Shipper(); $shipper->setName('ZipShip'); $shipper->setPerOunceRate(0.74); $po->setCustomer($customer); $po->setLineItems(array($lineItem1, $lineItem2)); $po->setShipper($shipper); $object = $unmarshaller->unmarshal($booksXml); $this->assertEquals($po, $object); }
if ($i % 10 === 0) { echo '.'; } } foreach ($sugar_demodata['manufacturer_seed_data_names'] as $v) { $manufacturer = new Manufacturer(); $manufacturer->name = $v; $manufacturer->status = "Active"; $manufacturer->list_order = "1"; $manufacturer->save(); $manufacturer_id_arr[] = $manufacturer->id; } echo '.'; $list_order = 1; foreach ($sugar_demodata['shipper_seed_data_names'] as $v) { $shipper = new Shipper(); $shipper->name = $v; $shipper->status = "Active"; $shipper->list_order = $list_order; $list_order++; $shipper->save(); $ship_id_arr[] = $shipper->id; } echo '.'; foreach ($sugar_demodata['productcategory_seed_data_names'] as $v) { $category = new ProductCategory(); $category->name = $v; $category->list_order = "1"; $key = array_rand($sugar_demodata['users']); $category->assigned_user_id = $sugar_demodata['users'][$key]['id']; $category->save();
<div class="row-fluid"> <div class="span3"> <table class="table table-condensed table-hover"> <thead> <tr> <th> Name </th> <th> </th> </tr> </thead> <tbody> <?php $shippers = Shipper::model()->findAll(array('order' => 'name ASC')); ?> <?php foreach ($shippers as $shipper) { ?> <tr> <td><?php echo $shipper->name; ?> </td> <td><a href="#">update</a> | <a href="#"> remove </a> </td> </tr> <?php } ?> </tbody>
.inputable input.smallinput.datefield { width:100px; } .inputable.bigs input { width:280px; } </style> <form method="get"> <?php $this->widget('SelectField', array('model' => $shipper, 'field' => 'id', 'htmlOptions' => array('id' => 'shipperId'), 'label' => 'Shipping company', 'options' => Shipper::model()->findAll(array('order' => 'name ASC')))); ?> </form> <form method="POST" action="<?php echo Yii::app()->createUrl('shipper/oceanTrade', array('shipperId' => $shipper->id)); ?> "> <input type="hidden" name="Shipper[id]" value="<?php echo $shipper->id; ?> "/> <div class="row"> <div class="span12"> <h3> (APL Charges) Charges </h3> <table class="table table-condensed table-hover inputable" id="datatable"> <thead>
/** * @return \yii\db\ActiveQuery */ public function getShipper() { return $this->hasOne(Shipper::className(), ['shipper_id' => 'shipper_id']); }