New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a list of objects #68
Comments
Hello @lisavd, Thank you for this interesting case. Indeed, it's not possible actually but you should be able to do the following: public function getLinkItems()
{
$items = array();
foreach ($links as $link){
$title = $link->getTitle();
$url = $link->getUrl();
$items[] = new GroupItemField('link', array(
new ItemField('url', $url),
new ItemField('title', $title)
));
}
return new GroupItemField('links', array($items));
} The only issue actually is that a FeedBundle/Formatter/Formatter.php Lines 150 to 178 in 4938892
We should update the code in order to do a recursive call in case of a Do you think you could work on this support? Elsewhere I can try to give it a look by the end of the week. Thank you |
Hi, I'm going to add inside the description tag. I was making it to difficult when it is actually not :) Thanks for the answer. Lisa |
Great @lisavd, it's fine if you've found a neat solution :) With pleasure, do not hesitate if you need help on another topics. I am keeping this issue opened as I will have a look on how to fix the nested issue by the end of the week. |
Signed-off-by: Vincent Composieux <vincent@composieux.fr>
Added ability to create nested group item fields (fixes #68)
As discussed, nested GroupItemFields are now implemented :) Thank you for your feedbacks! |
Hi,
I have a news article rss feed.
One news item has an array of multiple links, containing a title + url.
So I would like to add to my news item
<links>
<link>
<title>My title</title>
<url>My Url<url>
</link>
...
</links>
In my action I do this:
$news = $news_repo->getAllNews($locale);
$feedManager = $this->get('eko_feed.feed.manager');
$feed = $feedManager->get('news');
$feed->addFromArray($news);
I can add extra ItemFields and MediaItemFields.
But I don't know how I can add an array of multiple link objects containing title + url.
I have this in my entity:
And this in my action, but of course this is not correct:
$feed->addItemField( new GroupItemField('links', 'getLinkItems') );
Is there a way to do this?
Thanks.
The text was updated successfully, but these errors were encountered: