Hi Waigani,

entries must be an array of entries and each entry is an array itself.
This is the right version of your code, you are missing one array statement.

 //Feed Array
$feedArray = array(
                'title' => 'Test Feed',
                'link' => 'test.com',
                //'lastUpdate' => (0 == $posts->count() ? date('c',
strtotime()) : date('c')),
                'charset' => 'utf-8',
                'description' => 'First test feed',
                'author' => 'Jesse',
                'email' => '[EMAIL PROTECTED]',
                'copyright' => 'University, all rights reserved',
                'generator' => 'Zend Framework Zend_Feed',
                'language' => 'en',
                'entries' => array(
                    array(
                        'title' => 'Item One',
                        'link' => 'test.com',
                        'description' => 'this is a test feed',
                        'lastUpdate' => strtotime($post->updated),
                        'content' => 'Hello, this is the content',
                        )
                )
        );
 


Waigani wrote:
> 
> Hi,
> 
> I'm trying to import an array as a feed and get the following error:
> 
> 'Zend_Feed_Builder_Exception' with message 'title key of source property
> is missing' in …/Zend/Feed/Builder.php:368
> 
> Here is the code:
> 
>          //Feed Array
>       $feedArray = array(
>                       'title' => 'Test Feed',
>                       'link' => 'test.com',
>                       //'lastUpdate' => (0 == $posts->count() ? date('c', 
> strtotime()) :
> date('c')),
>                       'charset' => 'utf-8',
>                       'description' => 'First test feed',
>                       'author' => 'Jesse',
>                       'email' => '[EMAIL PROTECTED]',
>                       'copyright' => 'University, all rights reserved',
>                       'generator' => 'Zend Framework Zend_Feed',
>                       'language' => 'en',
>                       'entries' => array(
>                               'title' => 'Item One',
>                               'link' => 'test.com',
>                               'description' => 'this is a test feed',
>                               'lastUpdate' => strtotime($post->updated),
>                               'content' => 'Hello, this is the content',
>                       )
>               );
> 
>               // create feed document
>               $feed = Zend_Feed::importArray($feedArray, 'rss');
>               $feed->send();
> 
> Here are the lines around 368 in …/Zend/Feed/Builder.php:
> 
> if (isset($row['source'])) {
>                 $mandatories = array('title', 'url');
>                 foreach ($mandatories as $mandatory) {
>                     if (!isset($row['source'][$mandatory])) {
>                         throw new Zend_Feed_Builder_Exception("$mandatory
> key of source property is missing");
>                     }
>                 }
>                 $entry->setSource($row['source']['title'],
> $row['source']['url']);
>             }
> 
> 
> Now I've tried it with and without the 'source' array in the 'entries'
> array. I've even tried cutting and pasting what is in the manual:
> http://framework.zend.com/manual/en/zend.feed.importing.html
> 
> All produce exactly the same error. I'm using 1.03 libraries. Whats going
> on?!?
> 
> Thanks,
> Jess
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/%3A-exception-%27Zend_Feed_Builder_Exception%27-with-message-%27title-key-of-source-property-is-missing%27-tp14205926s16154p14250933.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to