本文整理汇总了PHP中self::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP self::setData方法的具体用法?PHP self::setData怎么用?PHP self::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::setData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildReverseTree
/**
* Generates a form to define the reverse values of a specific property for a resource
* This allows to set/remove multiple triples that share the same object
*
* @param core_kernel_classes_Resource $resource
* @param core_kernel_classes_Property $property
* @return tao_helpers_form_GenerisTreeForm
*/
public static function buildReverseTree(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property)
{
$tree = new self($resource, $property);
$domainCollection = $property->getDomain();
if (!$domainCollection->isEmpty()) {
$domain = $domainCollection->get(0);
$tree->setData('rootNode', $domain->getUri());
$tree->setData('dataUrl', _url('getData', 'GenerisTree', 'tao'));
$tree->setData('saveUrl', _url('setReverseValues', 'GenerisTree', 'tao'));
$values = array_keys($domain->searchInstances(array($property->getUri() => $resource), array('recursive' => true, 'like' => false)));
$tree->setData('values', $values);
$openNodeUris = tao_models_classes_GenerisTreeFactory::getNodesToOpen($values, $domain);
$tree->setData('openNodes', $openNodeUris);
}
return $tree;
}
示例2: findAllByOptionValue
public function findAllByOptionValue($value_id, $customer_id)
{
$tmp_cards = $this->getTable()->findAllByOptionValue($value_id, $customer_id);
$cards = array();
$remove_cards = false;
if (!empty($tmp_cards)) {
foreach ($tmp_cards as $tmp_card) {
$card = new self();
$card->setData($tmp_card->getData());
$is_locked = false;
if (!is_null($card->getLastError())) {
$now = $this->formatDate(null, 'y-MM-dd HH:mm:ss');
$date = new Zend_Date($card->getLastError());
$last_error = $date->addDay(1)->toString('y-MM-dd HH:mm:ss');
$is_locked = $last_error > $now && $card->getNumberOfError() >= 3;
if (!$last_error > $now) {
$card->setNumberOfError(0);
}
}
$card->setIsLocked($is_locked)->setId($card->getCustomerCardId());
// Si la carte est bloquée, on ne conserve que celle là, on supprime les autres et on stop le traitement
if ($is_locked) {
$cards = array($card);
break;
} else {
$cards[] = $card;
}
}
}
return $cards;
}
示例3: getInstance
/**
* Function to get the instance of the Tracker Record Model from the list of key-value mapping
* @param <Array> $valueMap
* @return Vtiger_TrackRecord_Model instance
*/
public static function getInstance($valueMap)
{
$instance = new self();
$instance->setData($valueMap);
$instance->setModule($valueMap['module_name']);
return $instance;
}
示例4: make
/**
* Create a new pattern template from array.
*
* @param array $data
* @return Raincolour\Containers\Template
*/
public static function make(array $data)
{
$template = new self();
$template->setData($data);
$template->validate();
return $template;
}
示例5: fromException
static function fromException($exception)
{
$exceptionClass = get_class($exception);
$response = new self();
if ($exception instanceof \RpcException) {
$response->setHttpStatus($exception->getHttpStatus());
$response->setCode($exception->getRpcErrorCode());
$response->setData(['data' => $exception->getData(), 'trace' => $exception->getTrace()]);
} else {
$response->setHttpStatus(500);
$response->setCode('UNKOWN');
$response->setData(['trace' => $exception->getTrace()]);
}
$response->setMessage($exception->getMessage());
return $response;
}
示例6: getInstance
/**
* Function to get the instance of the Tracker Record Model from the list of key-value mapping
* @param <Array> $valueMap
* @return Vtiger_TrackRecord_Model instance
*/
public static function getInstance($valueMap)
{
global $log;
$log->debug("Entering ./models/TrackRecord.php::staticgetInstance");
$instance = new self();
$instance->setData($valueMap);
$instance->setModule($valueMap['module_name']);
return $instance;
}
示例7: getInstanceFromLinkObject
/**
* Function to get the instance of CSS Script model from a given Vtiger_Link object
* @param Vtiger_Link $linkObj
* @return Vtiger_CssScript_Model instance
*/
public static function getInstanceFromLinkObject(Vtiger_Link $linkObj)
{
$objectProperties = get_object_vars($linkObj);
$linkModel = new self();
foreach ($objectProperties as $properName => $propertyValue) {
$linkModel->{$properName} = $propertyValue;
}
return $linkModel->setData($objectProperties);
}
示例8: factory
public static function factory(array $data)
{
$rpc = new self();
$rpc->setId($data['tid']);
$rpc->setAction($data['action']);
$rpc->setMethod($data['method']);
$rpc->setData($data['data'] ?: array());
$rpc->setParameters($data);
return $rpc;
}
示例9: getInstanceById
public static function getInstanceById($id)
{
$db = PearDatabase::getInstance();
$result = $db->pquery('SELECT * FROM yetiforce_menu WHERE id = ?;', [$id]);
if ($db->num_rows($result) == 0)
return false;
$instance = new self();
$instance->setData($db->raw_query_result_rowdata($result, 0));
return $instance;
}
示例10: __set
/**
* Método mágico (atribui)
* @param string $key
* @param mixed $value
* @return void
*/
public function __set($key, $value)
{
if (is_array($value)) {
$config = new self();
$value = $config->setData($value);
}
if (null === $key) {
$this->data[] = $value;
} else {
$this->data[$key] = $value;
}
}
示例11: getInstanceByCreator
public static function getInstanceByCreator(Users_Record_Model $user)
{
$db = PearDatabase::getInstance();
$query = 'SELECT * FROM ' . self::tableName . ' WHERE creatorid=?';
$result = $db->pquery($query, array($user->getId()));
$instance = new self();
if ($db->num_rows($result) > 0) {
$row = $db->query_result_rowdata($result, 0);
$instance->setData($row);
}
return $instance;
}
示例12: getInstanceById
public static function getInstanceById($reportModel) {
$self = new self();
$db = PearDatabase::getInstance();
$result = $db->pquery('SELECT * FROM vtiger_reporttype WHERE reportid = ?', array($reportModel->getId()));
$data = $db->query_result($result, 0, 'data');
if(!empty($data)) {
$decodeData = Zend_Json::decode(decode_html($data));
$self->setData($decodeData);
$self->setParent($reportModel);
$self->setId($reportModel->getId());
}
return $self;
}
示例13: getUserInstance
public static function getUserInstance($widgetId)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$db = PearDatabase::getInstance();
$result = $db->pquery('SELECT vtiger_module_dashboard_widgets.* FROM vtiger_module_dashboard_widgets
INNER JOIN vtiger_links ON vtiger_links.linkid = vtiger_module_dashboard_widgets.linkid
WHERE linktype = ? AND vtiger_module_dashboard_widgets.id = ? AND vtiger_module_dashboard_widgets.userid = ?', array('DASHBOARDWIDGET', $widgetId, $currentUser->getId()));
$self = new self();
if ($db->num_rows($result)) {
$row = $db->query_result_rowdata($result, 0);
$self->setData($row);
}
return $self;
}
示例14: create
public static function create($filters = null, $data = null, $accountBookingFilters = null)
{
if (!$filters) {
throw new Exception('No filters specified');
}
if (!$data) {
throw new Exception('No data specified');
}
$obj = new self();
$obj->setFilters($filters);
$obj->setData($data);
$obj->setAccountBookingFilters($accountBookingFilters);
return $obj;
}
示例15: load
/**
* Static method for loading a Config instance.
*
* @param string|array $path
*
* @return Config
*/
public static function load($path)
{
$self = new self([]);
$paths = $self->getValidPath($path);
$data = [];
foreach ($paths as $path) {
// Get file information
$info = pathinfo($path);
$extension = isset($info['extension']) ? $info['extension'] : '';
$parser = $self->getParser($extension);
// Try and load file
$data = array_replace_recursive($data, $parser->parse($path));
}
$self->setData($data);
return $self;
}