function ClientsHandlerEntityController::getClass in Web Service Clients 7.3
Helper to get the class to create for an entity.
Uses data in $entity_info['factory'].
Parameters
$entity_data: Either an array or an object of entity data.
Return value
The name of a class.
2 calls to ClientsHandlerEntityController::getClass()
- ClientsHandlerEntityController::create in includes/
clients.controller.inc - Implements EntityAPIControllerInterface.
- ClientsHandlerEntityController::load in includes/
clients.controller.inc - Overridden to implement factory-by-row pattern.
File
- includes/
clients.controller.inc, line 117 - Provides a controller building upon the Entity exportable controller but providing features for handler objects.
Class
- ClientsHandlerEntityController
- A controller for entities that function as handlers.
Code
function getClass($entity_data) {
if (is_object($entity_data)) {
$type = $entity_data->type;
}
else {
$type = $entity_data['type'];
}
$prefix = $this->entityInfo['factory']['class prefix'];
$connection_type = clients_get_connection_types($type);
if (empty($connection_type['class'])) {
$class = $prefix . $type;
}
else {
$class = $connection_type['class'];
}
if (class_exists($class)) {
return $class;
}
else {
return $this->entityInfo['factory']['broken class'];
}
}