namespace Friendica\Model;
use Friendica\Database\DBA;
+use \BadMethodCallException;
class ItemDeliveryData
{
public static function extractFields(array &$fields)
{
$delivery_data = [];
- foreach (ItemDeliveryData::FIELD_LIST as $key => $field) {
+ foreach (array_merge(ItemDeliveryData::FIELD_LIST, ItemDeliveryData::LEGACY_FIELD_LIST) as $key => $field) {
if (is_int($key) && isset($fields[$field])) {
// Legacy field moved from item table
$delivery_data[$field] = $fields[$field];
*
* @param integer $item_id
* @return bool
+ * @throws \Exception
*/
public static function incrementQueueDone($item_id)
{
* @param integer $item_id
* @param array $fields
* @return bool
+ * @throws \Exception
*/
public static function insert($item_id, array $fields)
{
if (empty($item_id)) {
- throw new \BadMethodCallException('Empty item_id');
+ throw new BadMethodCallException('Empty item_id');
}
$fields['iid'] = $item_id;
* @param integer $item_id
* @param array $fields
* @return bool
+ * @throws \Exception
*/
public static function update($item_id, array $fields)
{
if (empty($item_id)) {
- throw new \BadMethodCallException('Empty item_id');
+ throw new BadMethodCallException('Empty item_id');
}
if (empty($fields)) {
*
* @param integer $item_id
* @return bool
+ * @throws \Exception
*/
public static function delete($item_id)
{
if (empty($item_id)) {
- throw new \BadMethodCallException('Empty item_id');
+ throw new BadMethodCallException('Empty item_id');
}
return DBA::delete('item-delivery-data', ['iid' => $item_id]);