Closed aaslun closed 9 years ago
God catch!
You will not have to create a PR for this when you find the bug. This is fixed in my local version that is not yet pushed
/**
* Publishes a scheduled arlima list
* @param int $list_id
* @param int $version_id
*/
public static function publishScheduledList($list_id, $version_id)
{
$ver_repo = new Arlima_ListVersionRepository();
$list = Arlima_List::builder()
->id($list_id)
->version($version_id)
->includeFutureArticles()
->build();
if( $list->numArticles() > 0 ) {
// No articles would mean that the version did not exist (todo: how should one detect that a requested version does not exist)
$ver_repo->delete($version_id);
$ver_repo->create($list, $list->getArticles(), $list->getVersionAttribute('user_id')); // Publish the list as a new version
}
}
Great!! Thanks! :smile:
Ah, just noticed this: the Arlima_ListVersionRepository
is not yet available to me (guess it is still in your local version), but your code snippet still provides an approach for solving this using the Arlima_ListFactory
until your release.
It seems that scheduled deleted lists will still get published at the time of schedule even if they are deleted. The deleted list that gets published will be blank though. I'm looking into it in https://github.com/aaslun/Arlima/tree/schedule-bug-fix.