本文整理汇总了PHP中Self::validate_user_can_view_this_client方法的典型用法代码示例。如果您正苦于以下问题:PHP Self::validate_user_can_view_this_client方法的具体用法?PHP Self::validate_user_can_view_this_client怎么用?PHP Self::validate_user_can_view_this_client使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Self
的用法示例。
在下文中一共展示了Self::validate_user_can_view_this_client方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptionsClientsAction
/**
* @ApiDoc(
* description = "Display all clients. The reserved value 'all_clients', which is used to set a user's campaign permissions, should be hidden from the Create/Edit Campaign screen.",
* section="Z_DISABLED",
* statusCodes = {
* 200 = "Returned when the request is without errors",
* 403 = "Invalid API KEY",
* 404 = "The database has no clients momentarely.",
* 500 = "Header x-wsse does not exist"
* },
* requirements = {
* {
* "name" = "_format",
* "requirement" = "json|xml"
* }
* }
* )
* @return array
* @View()
*/
public function getOptionsClientsAction()
{
$user = $this->getUser();
$response = new Response();
$clients = $this->getDoctrine()->getRepository('CampaignBundle:Client')->findAllWithout_all_clients();
if (!$clients) {
$response->setStatusCode(404);
$response->setContent(json_encode(array('success' => false, 'message' => 'The database has no clients momentarely.')));
}
$clients_array = array();
foreach ($clients as $client) {
//print_r($client->getName());
$can_view = Self::validate_user_can_view_this_client($user, $client);
if ($can_view) {
$clients_array[$client->getId()] = ucfirst($client->getName());
}
if ($client->getName() == 'temp_client') {
$clients_array[$client->getId()] = ucfirst($client->getName());
}
}
//die();
// Order Clients alphabetically:
asort($clients_array);
$response->setStatusCode(200);
$response->setContent(json_encode(array('clients' => $clients_array)));
return $response;
}