本文整理汇总了PHP中Admin::getTableForClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::getTableForClass方法的具体用法?PHP Admin::getTableForClass怎么用?PHP Admin::getTableForClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin
的用法示例。
在下文中一共展示了Admin::getTableForClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayList
/** inheritdoc */
public static function displayList($value, $edit_link, &$settings, &$model)
{
$target_class = $settings['mapping']['targetEntity'];
$target_table = \Admin::getTableForClass($target_class);
if ($value instanceof \Doctrine\Common\Collections\Collection && count($value) > 0) {
return \Html::anchor("/admin/{$target_table}", count($value) . ' »');
} else {
return '0';
}
}
示例2: displayList
/** inheritdoc */
public static function displayList($value, $edit_link, &$settings, &$model)
{
$target_class = $settings['mapping']['targetEntity'];
$target_table = \Admin::getTableForClass($target_class);
if ($value instanceof \Doctrine\Common\Collections\Collection && count($value) > 0) {
$values = $value->toArray();
$output = '';
foreach ($values as $val) {
$output .= \Html::anchor("/admin/{$target_table}/" . $val->id . "/edit", $val->display()) . ', ';
}
return rtrim($output, ', ');
} else {
return '-';
}
}
示例3: processItem
protected function processItem(&$entity, $delete = false)
{
if (!empty($entity)) {
if (!empty($entity->settings) && isset($entity->settings['original_id']) && $entity->settings['original_id'] > 0) {
$tableName = \Admin::getTableForClass($entity->getEntityClass());
if (empty($this->jsonObject)) {
$this->jsonObject = new \stdClass();
$this->jsonObject->data = new \stdClass();
}
if (empty($this->jsonObject->data->{$tableName})) {
$this->jsonObject->data->{$tableName} = array();
}
$object = $entity->jsonLanguageDataObject($delete);
if (!in_array($object, $this->jsonObject->data->{$tableName})) {
$this->jsonObject->data->{$tableName}[] = $object;
}
}
}
}
示例4: buildSingleResult
protected function buildSingleResult($entity, &$results)
{
$root_type = $this->root;
// Get metadata for this result
$resultClass = get_class($entity);
$resultMeta = $resultClass::metadata();
$resultClass = $resultMeta->name;
$field_list = $this->getFieldsForModel($resultClass);
$associations = array_intersect($field_list, $resultMeta->getAssociationNames());
$fields = array_intersect($field_list, $resultMeta->getFieldNames());
$entity->__original_url_canonical = !empty($entity->url) && $entity->url instanceof \CMF\Model\URL ? rtrim(\Uri::base(false), '/') . '/' . ltrim($entity->url->url, '/') : "";
// Create a simple array version of the result
$output = $entity->toArray($fields);
$output_type = $resultMeta->name;
$output_id = $entity->id;
$this->addDiscriminator($entity, $output);
// Put the associations into their respective sideloaded arrays
foreach ($associations as $assoc) {
$assoc_class = $resultMeta->getAssociationTargetClass($assoc);
$type = \Inflector::pluralize(\Admin::getTableForClass($assoc_class));
if (!isset($this->output['included'][$type])) {
$this->output['included'][$type] = array();
}
if ($resultMeta->isCollectionValuedAssociation($assoc)) {
$output[$assoc] = array('ids' => array(), 'type' => $type, 'href' => \Uri::base(false) . "api/{$root_type}/{$output_id}/{$assoc}");
if (empty($entity->{$assoc})) {
continue;
}
foreach ($entity->{$assoc} as $assoc_value) {
$assoc_id = $assoc_value->id;
$output[$assoc]['ids'][] = $assoc_id;
if (!isset($this->output['included'][$type][$assoc_id]) && !($type == $this->root && (isset($this->output[$this->rootOutput][$assoc_id]) || $this->entityInResultSet($assoc_value, $results)))) {
$this->output['included'][$type][$assoc_id] = array();
$this->output['included'][$type][$assoc_id] = $this->buildSingleResult($assoc_value, $results);
}
}
} else {
if (empty($entity->{$assoc})) {
$output[$assoc] = null;
continue;
}
$assoc_id = $entity->{$assoc}->id;
$output[$assoc] = array('id' => $assoc_id, 'type' => $type, 'href' => \Uri::base(false) . "api/{$type}/{$assoc_id}");
if (!isset($this->output['included'][$type][$assoc_id]) && !($type == $this->root && (isset($this->output[$this->rootOutput][$assoc_id]) || $this->entityInResultSet($entity->{$assoc}, $results)))) {
$this->output['included'][$type][$assoc_id] = array();
$this->output['included'][$type][$assoc_id] = $this->buildSingleResult($entity->{$assoc}, $results);
}
}
}
return $output;
}
示例5: importType
/**
* @see \CMF\Model\Base::$_import_type
* @return string
*/
public static function importType()
{
$called_class = get_called_class();
if (empty($called_class::$_import_type)) {
return \Admin::getTableForClass($called_class);
}
return $called_class::$_import_type;
}