本文整理汇总了PHP中object::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP object::getData方法的具体用法?PHP object::getData怎么用?PHP object::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @param string $entityType
* @param object $entity
* @param array $arguments
* @return object
* @throws \Exception
*/
public function execute($entityType, $entity, $arguments = [])
{
$entityMetadata = $this->metadataPool->getMetadata($entityType);
$linkField = $entityMetadata->getLinkField();
$connection = $entityMetadata->getEntityConnection();
$oldStores = $this->resourcePage->lookupStoreIds((int) $entity->getId());
$newStores = (array) $entity->getStores();
if (empty($newStores)) {
$newStores = (array) $entity->getStoreId();
}
$table = $this->resourcePage->getTable('cms_page_store');
$delete = array_diff($oldStores, $newStores);
if ($delete) {
$where = [$linkField . ' = ?' => (int) $entity->getData($linkField), 'store_id IN (?)' => $delete];
$connection->delete($table, $where);
}
$insert = array_diff($newStores, $oldStores);
if ($insert) {
$data = [];
foreach ($insert as $storeId) {
$data[] = [$linkField => (int) $entity->getData($linkField), 'store_id' => (int) $storeId];
}
$connection->insertMultiple($table, $data);
}
return $entity;
}
示例2: handleEvent
/**
* Setup an Event
*
* Phalcon event to make sure client sends a valid message
* @return FALSE|void
*/
public function handleEvent()
{
$this->attach('micro', function ($event, $app) {
if ($event->getType() == 'beforeExecuteRoute') {
$data = $this->msg->getData();
ksort($data);
// Need to refactor this
$message = $this->msg->getTime() . $this->msg->getId() . implode($data);
$serverHash = hash_hmac('sha256', $message, $this->privateKey);
$clientHash = $this->msg->getHash();
$allowed = $clientHash === $serverHash ?: false;
$method = strtolower($app->router->getMatchedRoute()->getHttpMethods());
$unAuthenticated = $app->getUnauthenticated();
if (isset($unAuthenticated[$method])) {
$unAuthenticated = array_flip($unAuthenticated[$method]);
if (isset($unAuthenticated[$app->router->getMatchedRoute()->getPattern()])) {
$allowed = true;
}
}
if (!$allowed) {
$app->response->setStatusCode(401, "Unauthorized");
$app->response->setContent("Access denied");
$app->response->send();
return false;
}
}
});
}
示例3:
/**
* Test the ipc getData method
*/
function test_getData()
{
$id = $this->last_insert_id;
$type = 'text/x-vcard';
//$type = 'text/xml';
$version = '3.0';
return $this->ipc->getData($id, $type, $version);
}
示例4: getChangerName
/**
* Returns status changer name
* @param object $entry
* @return
*/
public function getChangerName($entry)
{
try {
if ($entry->getData('custom_field_4')) {
// Changed by customer
$ticketId = $entry->getData('custom_field_1');
return '[C] ' . Mage::getModel('helpdeskultimate/ticket')->load($ticketId)->getCustomer()->getName();
} else {
$departmentId = $entry->getData('custom_field_3');
return '[D] ' . Mage::getModel('helpdeskultimate/department')->load($departmentId)->getName();
}
} catch (Exception $e) {
return $this->__('Unknown department/customer');
}
}
示例5: getStatArray
/**
* Fetches statistics array for $phase form the output object.
*
* @param int $phase
* @return void
*/
protected function getStatArray($phase)
{
if ($this->output === null) {
return;
}
return $this->output->getData($phase);
}
示例6: testSetNamespaces
/**
* @covers Molajo\Resource\Proxy::setNamespace
* @covers Molajo\Resource\Proxy::exists
* @covers Molajo\Resource\Proxy::get
* @covers Molajo\Resource\Proxy::getCollection
* @covers Molajo\Resource\Proxy\Scheme::__construct
* @covers Molajo\Resource\Proxy\Scheme::setScheme
* @covers Molajo\Resource\Proxy\Scheme::getScheme
* @covers Molajo\Resource\Proxy\Scheme::setAdapterNamespaces
* @covers Molajo\Resource\Proxy\Scheme::saveNamespaceArray
* @covers Molajo\Resource\Proxy\Scheme::locateScheme
* @covers Molajo\Resource\Proxy\Scheme::getUriScheme
* @covers Molajo\Resource\Proxy\Scheme::removeUriScheme
*
* @return $this
* @since 1.0.0
*/
public function testSetNamespaces()
{
$this->setNs();
$expected_ns = array();
$row = new stdClass();
$row->namespace_prefix = 'Molajo\\A\\';
$row->base_directory = 'Source/A/';
$row->prepend = true;
$expected_ns[] = $row;
$row = new stdClass();
$row->namespace_prefix = 'Molajo\\B\\';
$row->base_directory = 'Source/B/';
$row->prepend = true;
$expected_ns[] = $row;
$row = new stdClass();
$row->namespace_prefix = 'Molajo\\C\\';
$row->base_directory = 'Source/C/';
$row->prepend = true;
$expected_ns[] = $row;
$row = new stdClass();
$row->namespace_prefix = 'Molajo\\Plugins\\';
$row->base_directory = 'Source/Plugins/';
$row->prepend = true;
$expected_ns[] = $row;
$actual_ns = $this->proxy_instance->getData('namespace_array');
$this->assertEquals($expected_ns, $actual_ns);
return $this;
}
示例7: dispatchCommand
/**
* @param object $command Pheanstalk_Command
* @return object Pheanstalk_Response
* @throws Pheanstalk_Exception_ClientException
*/
public function dispatchCommand($command)
{
$socket = $this->_getSocket();
$to_send = $command->getCommandLine() . self::CRLF;
if ($command->hasData()) {
$to_send .= $command->getData() . self::CRLF;
}
$socket->write($to_send);
$responseLine = $socket->getLine();
$responseName = preg_replace('#^(\\S+).*$#s', '$1', $responseLine);
if (isset(self::$_errorResponses[$responseName])) {
$exception = sprintf('Pheanstalk_Exception_Server%sException', self::$_errorResponses[$responseName]);
throw new $exception(sprintf("%s in response to '%s'", $responseName, $command));
}
if (in_array($responseName, self::$_dataResponses)) {
$dataLength = preg_replace('#^.*\\b(\\d+)$#', '$1', $responseLine);
$data = $socket->read($dataLength);
$crlf = $socket->read(self::CRLF_LENGTH);
if ($crlf !== self::CRLF) {
throw new Pheanstalk_Exception_ClientException(sprintf('Expected %u bytes of CRLF after %u bytes of data', self::CRLF_LENGTH, $dataLength));
}
} else {
$data = null;
}
return $command->getResponseParser()->parseResponse($responseLine, $data);
}
示例8: testGetData
/**
* @covers Cart\Api::getData
*/
public function testGetData()
{
$result = (array) json_decode($this->object->getData());
/** Check success answer */
$this->assertTrue($result['success']);
$this->assertFalse($result['errors']);
$this->assertCount(2, $result['data']);
$this->object->removeAll();
}
示例9: save
/**
* Save data to database.
*
* @return object Entity
*/
public function save()
{
foreach ($this->object->getData() as $field => $value) {
if (array_key_exists($field, $this->data)) {
$this->object->set($field, $this->data[$field]);
}
}
$this->object->save();
return $this->object;
}
示例10: connect
/**
* Attach a handler to the session validator chain
*
* @param string $topic
* @param string|object|Closure $context
* @param null|string $handler
* @return Zend\Stdlib\SignalHandler
*/
public function connect($topic, $context, $handler = null)
{
if ($context instanceof Validator) {
$data = $context->getData();
$name = $context->getName();
$this->getStorage()->setMetadata('_VALID', array($name => $data));
}
$handle = parent::connect($topic, $context, $handler);
return $handle;
}
示例11: get
/**
* Get the model state properties
*
* This function overloads the KObject::get() function and only acts on state
* properties
*
* If no property name is given then the function will return an associative
* array of all properties.
*
* If the property does not exist and a default value is specified this is
* returned, otherwise the function return NULL.
*
* @param string The name of the property
* @param mixed The default value
* @return mixed The value of the property, an associative array or NULL
*/
public function get($property = null, $default = null)
{
$result = $default;
if (is_null($property)) {
$result = $this->_state->getData();
} else {
if (isset($this->_state->{$property})) {
$result = $this->_state->{$property};
}
}
return $result;
}
示例12: testSetNSAfter
/**
* @covers Molajo\Resource\Proxy::setNamespace
* @covers Molajo\Resource\Proxy::exists
* @covers Molajo\Resource\Proxy::get
* @covers Molajo\Resource\Proxy::getCollection
* @covers Molajo\Resource\Proxy\Scheme::__construct
* @covers Molajo\Resource\Proxy\Scheme::setScheme
* @covers Molajo\Resource\Proxy\Scheme::getScheme
* @covers Molajo\Resource\Proxy\Scheme::setAdapterNamespaces
* @covers Molajo\Resource\Proxy\Scheme::saveNamespaceArray
* @covers Molajo\Resource\Proxy\Scheme::locateScheme
* @covers Molajo\Resource\Proxy\Scheme::getUriScheme
* @covers Molajo\Resource\Proxy\Scheme::removeUriScheme
* @covers Molajo\Resource\Adapter\NamespaceHandler::setNamespace
* @covers Molajo\Resource\Adapter\NamespaceHandler::exists
* @covers Molajo\Resource\Adapter\NamespaceHandler::get
* @covers Molajo\Resource\Adapter\NamespaceHandler::getCollection
* @covers Molajo\Resource\Adapter\NamespaceHandler::locateResourceNamespace
* @covers Molajo\Resource\Adapter\SetNamespace::setNamespaceExists
* @covers Molajo\Resource\Adapter\SetNamespace::appendNamespace
* @covers Molajo\Resource\Adapter\SetNamespace::prependNamespace
* @covers Molajo\Resource\Adapter\HandleNamespacePrefixes::searchNamespacePrefixes
* @covers Molajo\Resource\Adapter\HandleNamespacePrefixes::searchNamespacePrefix
* @covers Molajo\Resource\Adapter\HandleNamespacePrefixes::searchNamespacePrefixDirectory
* @covers Molajo\Resource\Adapter\HandleNamespacePrefixes::searchNamespacePrepareNamespacePath
* @covers Molajo\Resource\Adapter\HandleNamespacePrefixes::searchNamespaceFilename
* @covers Molajo\Resource\Adapter\HandleNamespacePrefixes::searchNamespacePrefixFileExtensions
* @covers Molajo\Resource\Adapter\HandleResourceMap::searchResourceMap
* @covers Molajo\Resource\Adapter\HandleResourceMap::searchResourceMapInstance
* @covers Molajo\Resource\Adapter\HandleResourceMap::setResourceMapPaths
* @covers Molajo\Resource\Adapter\HandleResourceMap::searchResourceMapPaths
* @covers Molajo\Resource\Adapter\HandleResourceMap::searchResourceMapFileExtensions
* @covers Molajo\Resource\Adapter\Base::__construct
* @covers Molajo\Resource\Adapter\Base::initialiseCacheVariables
* @covers Molajo\Resource\Adapter\Base::setScheme
* @covers Molajo\Resource\Adapter\Base::setResourceNamespace
* @covers Molajo\Resource\Adapter\Cache::getConfigurationCache
* @covers Molajo\Resource\Adapter\Cache::setConfigurationCache
* @covers Molajo\Resource\Adapter\Cache::deleteConfigurationCache
* @covers Molajo\Resource\Adapter\Cache::useConfigurationCache
* @covers Molajo\Resource\Adapter\Cache::getCache
* @covers Molajo\Resource\Adapter\Cache::setCache
* @covers Molajo\Resource\Adapter\Cache::deleteCache
* @covers Molajo\Resource\Adapter\Cache::clearCache
*
* @return $this
* @since 1.0.0
*/
public function testSetNSAfter()
{
$this->setAdapter();
$this->setNs();
$expected_ns = array();
$expected_ns['Molajo\\A\\'] = array('Source/A/');
$expected_ns['Molajo\\B\\'] = array('Source/B/');
$expected_ns['Molajo\\C\\'] = array('Source/C/');
$expected_ns['Molajo\\Plugins\\'] = array('Source/Plugins/');
$this->assertEquals($expected_ns, $this->adapter_instance->getData('namespace_prefixes'));
return $this;
}
示例13: handleEvent
/**
* Setup an Event
*
* Phalcon event to make sure client sends a valid message
* @return FALSE|void
*/
public function handleEvent()
{
$this->attach('micro', function ($event, $app) {
if ($event->getType() == 'beforeExecuteRoute') {
$iRequestTime = $this->_msg->getTime();
$msgData = is_array($this->_msg->getData()) ? http_build_query($this->_msg->getData(), '', '&') : $this->_msg->getData();
$data = $iRequestTime . $this->_msg->getId() . $msgData;
$serverHash = hash_hmac('sha256', $data, $this->_privateKey);
$clientHash = $this->_msg->getHash();
// security checks, deny access by default
$allowed = false;
if ($clientHash === $serverHash) {
// 1st security level - check hashes
if (time() - $iRequestTime <= $this->_maxRequestDelay) {
// 2nd security level - ensure request time hasn't expired
$allowed = true;
// gain access, everyting ok
}
}
if (!$allowed) {
// already authorized skip this part
// last try - login without auth for open calls
$method = strtolower($app->router->getMatchedRoute()->getHttpMethods());
$unAuthenticated = $app->getUnauthenticated();
if (isset($unAuthenticated[$method])) {
$unAuthenticated = array_flip($unAuthenticated[$method]);
if (isset($unAuthenticated[$app->router->getMatchedRoute()->getPattern()])) {
return true;
// gain access to open call
}
}
// still not authorized, get out of here
$app->response->setStatusCode(401, "Unauthorized");
$app->response->setContent("Access denied");
$app->response->send();
return false;
}
}
});
}
示例14: addPa2ImageToTemplate
/**
* addPa2ImageToTemplate function.
*
* @access public
* @param object $objTemplate
* @param array $arrMergeData (default: array())
* @return object
*/
public function addPa2ImageToTemplate($objTemplate, $arrMergeData = array())
{
if (isset($this->uuid) && is_array($arrMergeData)) {
$objFile = $this->getPa2Image();
if ($objFile !== null && is_file(TL_ROOT . '/' . $objFile->path)) {
$arrData = $objTemplate->getData();
$arrData['singleSRC'] = $objFile->path;
if (count($arrMergeData) > 0) {
$arrData = array_merge($arrData, $arrMergeData);
}
$this->addImageToTemplate($objTemplate, $arrData);
}
}
return $objTemplate;
}
示例15: analyzePage
public function analyzePage()
{
$data = $this->dataProvider->getData(true);
foreach ($data as $rowBean) {
assert('$rowBean->id != null');
$columnMessages = array();
$shouldSkipRow = false;
foreach ($this->sanitizableColumnNames as $columnName) {
$attributeIndexOrDerivedType = $this->mappingData[$columnName]['attributeIndexOrDerivedType'];
$penultimateModelClassName = ImportUtil::getPenultimateModelClassNameByImportRules($this->importRules);
$attributeImportRules = AttributeImportRulesFactory::makeByImportRulesTypeAndAttributeIndexOrDerivedType($this->importRules->getType(), $attributeIndexOrDerivedType, $penultimateModelClassName);
$modelClassName = $attributeImportRules->getModelClassName();
$attributeName = static::resolveAttributeNameByRules($attributeImportRules);
if (null != ($attributeValueSanitizerUtilTypes = $attributeImportRules->getSanitizerUtilTypesInProcessingOrder())) {
assert('is_array($attributeValueSanitizerUtilTypes)');
foreach ($attributeValueSanitizerUtilTypes as $attributeValueSanitizerUtilType) {
$sanitizer = ImportSanitizerUtilFactory::make($attributeValueSanitizerUtilType, $modelClassName, $attributeName, $columnName, $this->mappingData[$columnName], null, $penultimateModelClassName, $attributeIndexOrDerivedType);
$sanitizer->analyzeByRow($rowBean);
if ($sanitizer->getShouldSkipRow()) {
$shouldSkipRow = true;
}
foreach ($sanitizer->getAnalysisMessages() as $message) {
$columnMessages[$columnName][] = $message;
}
$classToEvaluate = new ReflectionClass($sanitizer);
if ($classToEvaluate->implementsInterface('ImportSanitizerHasCustomFieldValuesInterface')) {
$missingCustomFieldValues = $sanitizer->getMissingCustomFieldValues();
$this->getCustomFieldsInstructionData()->addMissingValuesByColumnName($missingCustomFieldValues, $columnName);
}
}
}
}
if (!empty($columnMessages)) {
$rowBean->serializedAnalysisMessages = serialize($columnMessages);
if ($shouldSkipRow) {
$rowBean->analysisStatus = static::STATUS_SKIP;
} else {
$rowBean->analysisStatus = static::STATUS_WARN;
}
} else {
$rowBean->serializedAnalysisMessages = null;
$rowBean->analysisStatus = static::STATUS_CLEAN;
}
ZurmoRedBean::store($rowBean);
}
}