userIdEqual works in console, not in app

2 replies [Last post]
Joined: 05/17/2011
Points: 122

I must be doing something terribly stupid here...

In the "Test Me Console" this code works:

<?php
require_once('lib/KalturaClient.php');
$config = new KalturaConfiguration($partnerId);
$config->serviceUrl = 'http://www.kaltura.com/';
$client = new KalturaClient($config);
$filter = null;
$pager = null;
$client->setKs('NDMxYTdhZjEzYTE2MDY0MDhkODI5YjM1NmZlZTI0NmVmNjE5Mjg5NnwzNTEzNjE7OzEzMDU2NTI1NzU7MjsxMzA1NjQ1Mzc1LjEzNDg7Ow==');
$filter = new KalturaMediaEntryFilter();
$filter->userIdEqual = 'demo';
$results = $client->media->listAction($filter, $pager);

However, in my PHP code, the following gets ALL the videos we've ever uploaded, as far as I can tell:

  function client (){
    static $client;
    if (isset($client)) return $client;

    $client = KalturaClientHelper::getClient(KalturaSessionType::ADMIN);
    return $client;
  }

  function get_videos(){
    $client = client();
error_log($client->getKS());
    $filter = new KalturaMediaEntryFilter();
    #$filter->mediaTypeEqual = KalturaMediaType::VIDEO;
    $fitler->userIdEqual = 'demo';
    $pager = new KalturaFilterPager();
    $pager->pageSize = 40;
    $pager->pageIndex = max(1, isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : 1);
    #$matches = $client->baseEntry->listAction($filter, $pager);
    $matches = $client->media->listAction($filter, $pager);
    #$total = $matches->totalCount;
    #$videos = $matches->objects;
   
    #$usage = $client->partner->getUsage();
#error_log(print_r($usage, 1));
    return $matches;
  }

Obviously I've tried a few different things here, including:
baseEntry vs media (same output)
ADMIN vs USER (admin all, USER nothing)
$pager = null; (same output)

Any insights would be most appreciated!

Joined: 02/22/2009
Points: 97

simply small typo of variable name:
$fitler->userIdEqual = 'demo';
should be:
$filter->userIdEqual = 'demo';

sometimes the advantage of PHP's simplicity comes as a disadvantage I guess...

Joined: 05/17/2011
Points: 122

Who changed my php.ini error_reporting back to default?!

E_NOTICE should be on!

I've lobbied the PHP Dev Group about this for years, to no avail.

Grrrrr.

Sorry for the noise.