/** * Builds the Data Object * * @return AbstractSimpleObject */ public function create() { $dataObjectType = $this->_getDataObjectType(); $dataObject = $this->objectFactory->create($dataObjectType, ['data' => $this->data]); $this->data = []; return $dataObject; }
/** * Builds the Data Object * * @return AbstractSimpleObject */ public function create() { $dataObjectType = $this->_getDataObjectType(); $dataObject = $this->objectFactory->create($dataObjectType, ['builder' => $this]); $this->_data = array(); return $dataObject; }
/** * @param ExtensibleDataInterface $dataObject * @param string $getterMethodName * @param string $methodName * @param array $value * @param string $interfaceName * @return $this */ protected function setComplexValue(ExtensibleDataInterface $dataObject, $getterMethodName, $methodName, array $value, $interfaceName) { if ($interfaceName == null) { $interfaceName = get_class($dataObject); } $returnType = $this->objectProcessor->getMethodReturnType($interfaceName, $getterMethodName); if ($this->typeProcessor->isTypeSimple($returnType)) { $dataObject->{$methodName}($value); return $this; } if ($this->typeProcessor->isArrayType($returnType)) { $type = $this->typeProcessor->getArrayItemType($returnType); $objects = []; foreach ($value as $arrayElementData) { $object = $this->objectFactory->create($type, []); $this->populateWithArray($object, $arrayElementData, $type); $objects[] = $object; } $dataObject->{$methodName}($objects); return $this; } if (is_subclass_of($returnType, '\\Magento\\Framework\\Api\\ExtensibleDataInterface')) { $object = $this->objectFactory->create($returnType, []); $this->populateWithArray($object, $value, $returnType); } else { if (is_subclass_of($returnType, '\\Magento\\Framework\\Api\\ExtensionAttributesInterface')) { $object = $this->extensionFactory->create(get_class($dataObject), $value); } else { $object = $this->objectFactory->create($returnType, $value); } } $dataObject->{$methodName}($object); return $this; }
public function __construct($reactionID) { $dbMgr = new DatabaseManager(true); $objectData = $dbMgr->getReactionData($reactionID); $this->reactionID = $objectData['reactionID']; $this->reactionType = $objectData['reactionType']; $this->inputs = $dbMgr->getReactionInputs($this->reactionID); $objectFactory = new ObjectFactory(); foreach ($this->inputs as $input) { $inputType = $objectFactory->create(ObjectFactory::TYPE, $input['typeID']); $inputVolume = $inputType->getVolume() * $input['inputQty']; $this->inputVolume += $inputVolume; } $this->output = $objectFactory->create(ObjectFactory::TYPE, $objectData['typeID']); $this->outputQty = $objectData['outputQty']; $this->outputVolume = $this->outputQty * $this->output->getVolume(); $this->reactionName = $this->output->getName(); if ($this->reactionType == 3) { $this->reactionName += " Alchemy"; } $dbMgr = null; }
/** * {@inheritdoc} */ public function create() { if ($this->getDataType() == self::TYPE_DATA_MODEL) { /** @var \Magento\Framework\Model\AbstractExtensibleModel $dataObject */ $dataObject = $this->objectFactory->create($this->_getDataObjectType(), ['data' => $this->data]); $dataObject->setDataChanges(true); } else { $dataObjectType = $this->_getDataObjectType(); $dataObject = $this->objectFactory->create($dataObjectType, ['builder' => $this]); } if ($dataObject instanceof \Magento\Framework\Object) { $dataObject->setDataChanges(true); } $this->data = []; return $dataObject; }
<?php require_once 'include/session_setup.php'; $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $start = $time; $scriptName = basename($_SERVER['PHP_SELF']); $dbMgr = new DatabaseManager(true); $objectFactory = new ObjectFactory(); $formBuilder = new FormBuilder(); if (isset($argArray['re'])) { $reactionID = $argArray['re']; $reaction = $objectFactory->create(ObjectFactory::REACTION, $reactionID); } if (isset($argArray['c']) && $reaction->getReactionType() == 2) { $chain = 1; $chainStr = "Reaction Chain"; } else { $chain = 0; $chainStr = "Reaction"; } if (isset($argArray['d'])) { $datetime = $dbMgr->getLastTimestamp($argArray['d'], 300); $dateChanged = 1; } else { $datetime = $dbMgr->getLastTimestamp(time(), 300); } $options = array("r" => $_SESSION['params']['r'], "c" => $chain, "s" => $_SESSION['params']['s'], "g" => $_SESSION['params']['g'], "sy" => $_SESSION['params']['sy'], "i" => $_SESSION['params']['i'], "f" => $_SESSION['params']['f'], "o" => $_SESSION['params']['o'], "st" => $_SESSION['params']['st'], "b" => $_SESSION['params']['b'], "t" => $_SESSION['params']['t']); ?> <!DOCTYPE html>
<body role="document"> <?php include 'include/pages/navbar.php'; ?> <div class="container-fluid"> <div class="page-header"> <h1 class="center">Reaction Input Lookup</h1> </div> <?php require_once 'include/session_setup.php'; $objectFactory = new ObjectFactory(); $formBuilder = new FormBuilder(); $scriptName = basename($_SERVER['PHP_SELF']); if (isset($_POST['re'])) { $reactionID = $_POST['re']; $reaction = $objectFactory->create(ObjectFactory::REACTION, $reactionID); $reactionType = $reaction->getReactionType(); if ($reactionType == 3) { $reactionName = $reaction->getOutput()->getName() . " Alchemy"; } else { $reactionName = $reaction->getOutput()->getName(); } $inputs = $reaction->getInputs(); ?> <div class="center"> <form class="form-inline" style="display:inline" method="post" action="<?php echo $scriptName; ?> "> <input type='hidden' name='reset' value='1'> <button type='submit' class='btn btn-xs btn-danger'>Reset</button>
?> "> <input type="hidden" name="reset" value="1"> </form> <div class="btn-group btn-group-xs"> <button class="btn btn-success" type="submit" form="configure">Configure</button> <button class="btn btn-danger" type="submit" form="reset">Reset</button> <a class="btn btn-primary" href=" <?php $formBuilder->generatePermalink($options); ?> ">Permalink</a> </div> </div> <?php $system = $objectFactory->create(ObjectFactory::SYSTEM, $_SESSION['params']['sy']); $systemName = $system->getSystemName(); $numCycles = $dbMgr->getNumCycles($_SESSION['params']['t']); $simpleReactions = $dbMgr->getAllReactionIDs(1); $complexReactions = $dbMgr->getAllReactionIDs(2); $alchemyReactions = $dbMgr->getAllReactionIDs(3); $polymerReactions = $dbMgr->getAllReactionIDs(4); ?> <div class="center"> <img src="include/images/moonminingbee.png" alt="Moon mining bee wants your precious goo." style="width:200px;height:225px;float:right;" alt=""> <p>This dashboard shows real-time net income calculations for all simple and complex reactions. Assumptions are:</p> <ul> <li>Simple, alchemy, and polymer reactions are calculated as a single reaction on a medium tower.</li> <?php if ($_SESSION['params']['r'] == 3) { ?>
function & createObject($object_path, $args = array())//fix? { include_once(LIMB_DIR . '/core/ObjectFactory.class.php'); return ObjectFactory :: create($object_path, $args); }