Invalid object type

3 replies [Last post]
Joined: 05/18/2009
Points: 13

I've used action listAction to list kaltura users. Here is the code:

$config = new KalturaConfiguration(PARTNER_ID);
$config->serviceUrl = SERVER_URL;
$client = new KalturaClient($config);
$ks = $client->session->start(ADMIN_SECRET, "USERID", KalturaSessionType::ADMIN);
$client->setKS($ks);/*

$pager = new KalturaFilterPager();
$pager->pageSize = 12;
$pager->pageIndex = 1;
$filter = new KalturaUserFilter();
$filter->orderBy = "-createdAt";
       
try
{
        $u=$client->user->listAction($filter, $pager);
}
catch (Exception $ex)
{
        $error = $ex->getMessage();
}

And I've got the error 'Invalid object type'. Then I've looked the client library KalturaClient.php, function listAction in class KalturaUserService and saw that
$this->client->validateObjectType($resultObject, "array");
but $resultObject was the object.

I replaced 'array' by 'object' and everything became fine.

Is there situations when $resultObject will be an array?

Joined: 05/18/2009
Points: 13

Well. I have a look validateObjectType function in KalturaClientBase.php and get a new result :)

There is no definiton of the classes KalturaUserListResponse and KalturaPlaylistListResponse in KalturaClient.php. That's why $resultObject in listAction function became '__PHP_Incomplete_Class Object'.

So, the result:
in class KalturaUserService, function listAction I wrote
$this->client->validateObjectType($resultObject, "KalturaUserListResponse");
and in class KalturaPlaylistService, function listAction
$this->client->validateObjectType($resultObject, "KalturaPlaylistListResponse");

Joined: 01/05/2009
Points: 1697

Hi Mikhail,

Are you using the api_v3 client library from KalturaCE or partner service 2 from the project page?

Joined: 05/18/2009
Points: 13

Hi Zohar,

I have used partner service 2.
With api_v3, everything is ok, thanks. I'will use it.