本文整理汇总了PHP中self::populate方法的典型用法代码示例。如果您正苦于以下问题:PHP self::populate方法的具体用法?PHP self::populate怎么用?PHP self::populate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::populate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reorder
/**
* Reorder macro
*/
public function reorder($from, $to)
{
$from = preg_replace('/[^0-9a-z_A-Z- \\.]/', '', $from);
$to = preg_replace('/[^0-9a-z_A-Z- \\.]/', '', $to);
$barcodeMacroFrom = new self();
$barcodeMacroFrom->name = $from;
$barcodeMacroFrom->populate();
if (!strlen($barcodeMacroFrom->macro) > 0) {
return;
}
$barcodeMacroTo = new self();
$barcodeMacroTo->name = $to;
$barcodeMacroTo->populate();
if (!strlen($barcodeMacroTo->macro) > 0) {
return;
}
$db = Zend_Registry::get("dbAdapter");
$db->beginTransaction();
try {
$orderFrom = $barcodeMacroFrom->order;
$barcodeMacroFrom->order = $barcodeMacroTo->order;
$barcodeMacroFrom->persist();
$barcodeMacroTo->order = $orderFrom;
$barcodeMacroTo->persist();
$db->commit();
} catch (Exception $e) {
$db->rollBack();
trigger_error($e->getMessage(), E_USER_NOTICE);
}
}
示例2: check_login
public function check_login($username = '', $password = '', $type = 1)
{
$query = $this->db->get_where($this::DB_TABLE, array('username' => $username, 'password' => $password, 'type' => $type), 1);
$user = new self();
$user->populate($query->row());
return $query->row() ? $user : false;
}
示例3: plant
public static function plant($mixedId, $mixedKind = "WP_Post", $dataset = array())
{
$tree = new self();
$tree->setQuerier(Strata::I18n()->query());
$tree->setContext($mixedId, $mixedKind);
$tree->populate($dataset);
return $tree;
}
示例4: loadQuestion
/**
* Handles loading a question, populating it with the given data
*
* This will return a clean copy of the plugin, populated with the values
* from the data array
*
* @param array $data
* @return \self
*/
public function loadQuestion($data)
{
$question = new self($this->pluginManager, $this->id);
$question->populate($data);
$question->isQuestion(true);
// Signal this is not the plugin, but a question object
return $question;
}
示例5: fetch
public static function fetch($pidm, $aid_year)
{
$statuses = array();
$rset = self::get_status($pidm, $aid_year);
foreach ($rset as $row) {
$status = new self();
$status->populate($row);
$statuses[] = $status;
}
return $statuses;
}
示例6: make
public function make(array $array)
{
$return = array();
foreach ($array as $k => $v) {
if (Arrays::is($v)) {
$o = new self();
$return[$k] = $o->populate($v);
} else {
$return[$k] = $v;
}
}
return $return;
}
示例7: generateVitalSignsTemplateKeyValue
public static function generateVitalSignsTemplateKeyValue($vitalSignTemplateId = 1)
{
$vitalSignTemplate = new self();
$vitalSignTemplate->vitalSignTemplateId = $vitalSignTemplateId;
$vitalSignTemplate->populate();
$vitals = array();
try {
$template = new SimpleXMLElement($vitalSignTemplate->template);
foreach ($template as $vital) {
$title = (string) $vital->attributes()->title;
$vitals[$title] = (string) $vital->attributes()->label;
}
} catch (Exception $e) {
WebVista::debug($e->getMessage());
}
return $vitals;
}
示例8: persist
public function persist()
{
$visit = new self();
$visit->visitId = $this->encounter_id;
$visit->populate();
$oldClosed = $visit->closed;
$ret = parent::persist();
$newClosed = $this->closed;
if ($newClosed) {
$newClaim = false;
if ($newClosed && $oldClosed !== $newClosed && !ClaimLine::mostRecentClaim($this->encounter_id, true) > 0) {
// recalculate claim lines if closed visit is new/reopened
$newClaim = true;
}
$ret = self::recalculateClaims($this, $newClaim);
}
return $ret;
}
示例9: populate
public function populate(array $datas, $namespace = null)
{
if (null !== $namespace) {
if (!isset($this->{$namespace})) {
$this->{$namespace} = array();
}
foreach ($datas as $k => $v) {
if (Arrays::is($k)) {
$this->populate($k, $namespace);
} else {
$this->{$namespace} = array_merge($this->{$namespace}, array($k => $v));
}
}
} else {
foreach ($datas as $k => $v) {
if (Arrays::is($v)) {
$o = new self();
$o->populate($v);
$this->{$k} = $o;
} else {
$this->{$k} = $v;
}
if (!Arrays::inArray($k, $this->_fields)) {
$this->_fields[] = $k;
}
}
}
return $this;
}
示例10: instance
public static function instance(array $data)
{
$object = new self();
$object->populate($data);
return $object;
}
示例11: refillRequestDatasourceHandler
public static function refillRequestDatasourceHandler(Audit $auditOrm, $eachTeam = true)
{
$ret = array();
if ($auditOrm->objectClass != 'MedicationRefillRequest') {
WebVista::debug('Audit:objectClass is not MedicationRefillRequest');
return $ret;
}
$orm = new self();
$orm->messageId = $auditOrm->objectId;
if (!$orm->populate()) {
WebVista::debug('Failed to populate');
return $ret;
}
$objectClass = get_class($orm);
$messaging = new Messaging();
$messaging->messagingId = $orm->messageId;
$messaging->populate();
$medicationId = (int) $orm->medicationId;
$providerId = (int) $messaging->providerId;
$personId = (int) $messaging->personId;
//if (!$personId > 0 || !$medicationId > 0) {
if (!$personId > 0) {
WebVista::debug('Refill request needs manual matching');
return $ret;
}
$patient = new Patient();
$patient->personId = $personId;
$patient->populate();
$teamId = (string) $patient->teamId;
$alert = new GeneralAlert();
$alertTable = $alert->_table;
$msgTable = $messaging->_table;
$db = Zend_Registry::get('dbAdapter');
$sqlSelect = $db->select()->from($msgTable, null)->join($alertTable, $alertTable . '.objectId = ' . $msgTable . '.messagingId')->where($msgTable . '.objectType = ?', Messaging::TYPE_EPRESCRIBE)->where($msgTable . '.messageType = ?', 'RefillRequest')->where("{$alertTable}.status = 'new'")->where($alertTable . '.objectClass = ?', $objectClass)->where($alertTable . '.userId = ?', $providerId)->where($msgTable . '.personId = ?', $personId)->limit(1);
if ($eachTeam) {
$sqlSelect->where($alertTable . '.teamId = ?', $teamId);
}
$alert->populateWithSql($sqlSelect->__toString());
$messages = array();
if ($alert->generalAlertId > 0) {
// existing general alert
$messages[] = $alert->message;
} else {
// new general alert
$alert->urgency = 'High';
$alert->status = 'new';
$alert->dateTime = date('Y-m-d H:i:s');
$alert->objectClass = $objectClass;
$alert->objectId = $auditOrm->objectId;
$alert->userId = (int) $providerId;
if ($eachTeam) {
$alert->teamId = $teamId;
}
}
$messages[] = 'Refill request pending. ' . $orm->details;
$alert->message = implode("\n", $messages);
return $alert->toArray();
}
示例12: populate
public function populate(array $datas, $namespace = null)
{
if (null !== $namespace) {
if (!isset($this->{$namespace})) {
$this->{$namespace} = [];
}
foreach ($datas as $k => $v) {
if (Arrays::is($k)) {
$this->populate($k, $namespace);
} else {
$this->{$namespace} = array_merge($this->{$namespace}, [$k => $v]);
}
}
} else {
foreach ($datas as $k => $v) {
$id = isAke($datas, 'id', false);
if (Arrays::is($v) && false === $id) {
if (Arrays::isAssoc($v)) {
$o = new self();
$o->populate($v);
$this->{$k} = $o;
} else {
$this->{$k} = $v;
}
} else {
$this->{$k} = $v;
}
if (!Arrays::in($k, $this->_fields)) {
$this->_fields[] = $k;
}
}
}
return $this;
}
示例13: factory
public static function factory($orderId)
{
$orm = new self();
$orm->orderId = (int) $orderId;
$orm->populate();
if ($orm->type == self::TYPE_LAB_TEST) {
$ormObj = new OrderLabTest();
$ormObj->orderId = $orm->orderId;
$ormObj->populate();
} else {
if ($orm->type == self::TYPE_IMAGING) {
$ormObj = new OrderImaging();
$ormObj->orderId = $orm->orderId;
$ormObj->populate();
} else {
$ormObj = $orm;
}
}
return $ormObj;
}
示例14: getAttending
public static function getAttending($teamId)
{
$name = TeamMember::ENUM_PARENT_NAME;
$enumeration = new Enumeration();
$enumeration->populateByUniqueName($name);
$enumerationsClosure = new EnumerationsClosure();
$rowset = $enumerationsClosure->getAllDescendants($enumeration->enumerationId, 1);
$ret = 0;
foreach ($rowset as $row) {
if ($teamId == $row->key) {
$attendings = $enumerationsClosure->getAllDescendants($row->enumerationId, 1);
foreach ($attendings as $attending) {
$teamMember = new self();
$teamMember->teamMemberId = (int) $attending->ormId;
$teamMember->populate();
$ret = $teamMember->personId;
break 2;
}
}
}
return $ret;
}
示例15: createDefaultConfigIfNotExists
/**
* Create ConfigItem for default formulary table
*
* @return void
*/
public static function createDefaultConfigIfNotExists()
{
$defaultTable = self::getDefaultFormularyTable();
if ($defaultTable !== false) {
$formulary = new self($defaultTable);
if (!$formulary->populate(false)) {
$formulary->activate();
$formulary->setDefault();
$formulary->persist(false);
}
}
}