本文整理匯總了PHP中type::toArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::toArray方法的具體用法?PHP type::toArray怎麽用?PHP type::toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::toArray方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: areImagesValid
public function areImagesValid(ExecutionContext $context)
{
$captured_ids = array_map(function ($image) {
return $image->getId();
}, $this->images->toArray());
$property_path = $context->getPropertyPath() . '.images';
if (!count($captured_ids)) {
$context->addViolationAt($property_path, 'Please select at least one image!', array(), null);
return;
}
$count = $this->query_builder->andWhere($this->query_builder->expr()->in('i.id', $captured_ids))->select('COUNT(i.id)')->getQuery()->getSingleScalarResult();
if (!$count) {
$context->addViolation('Please select images from the list!', array(), null);
}
}
示例2: saveSettings
/**
*
* @param type $params
*/
public static function saveSettings($params)
{
$oPlugin = JchPlatformPlugin::getPlugin();
$oPlugin->params = $params->toArray();
$oData = new JRegistry($oPlugin);
$aData = $oData->toArray();
$oController = new JControllerLegacy();
$oController->addModelPath(JPATH_ADMINISTRATOR . '/components/com_plugins/models', 'PluginsModel');
$oPluginModel = $oController->getModel('Plugin', 'PluginsModel');
if ($oPluginModel->save($aData) === FALSE) {
JchOptimizeLogger::log(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $oPluginModel->getError()), $params);
}
}
示例3: streamWMS
/**
* Stream WMS tiles for $feature in high resolution
* or in low resolution if $lowResolution is set to true
*
* @param type $feature
* @param type $lowResolution
*/
public function streamWMS($feature, $lowResolution = false)
{
/*
* Easy case - no feature or no WMS
*/
if (!isset($feature)) {
RestoLogUtil::httpError(404);
}
$featureArray = $feature->toArray();
if (!isset($featureArray['properties']['wmsInfos'])) {
RestoLogUtil::httpError(404);
}
$this->stream($this->getWMSUrl($featureArray['properties']['wmsInfos'], $lowResolution));
}
示例4: mapNode
/**
* Node mapper
*
* @param type $config
* @return \Core\Plugins\Navigation\Node
*/
public function mapNode($config)
{
$node = new Node();
$allData = $config->toArray();
foreach ($allData as $key => $value) {
if ($key == 'childs') {
continue;
}
$node->{'set' . ucfirst($key)}($value);
}
if (isset($config->childs)) {
$collection = $this->mapCollection($config->childs, $node);
$node->setChilds($collection);
}
return $node;
}
示例5: retrieveDefinitionData
/**
* @param $id
* @return array
* @codeCoverageIgnore
*/
public function retrieveDefinitionData($id)
{
$this->definitionBean->retrieve($id);
return $this->definitionBean->toArray();
}