protected function isNewRecord(DeliveryMonitoringDataInterface $deliveryMonitoring)
    {
        $data = $deliveryMonitoring->get();
        $deliveryExecutionId = $data[self::COLUMN_DELIVERY_EXECUTION_ID];

        $sql = "SELECT EXISTS( " . PHP_EOL .
            "SELECT " . self::COLUMN_DELIVERY_EXECUTION_ID . PHP_EOL .
            "FROM " . self::TABLE_NAME . PHP_EOL .
            "WHERE " . self::COLUMN_DELIVERY_EXECUTION_ID . "=?)";
        $exists = $this->getPersistence()->query($sql, [$deliveryExecutionId])->fetch(\PDO::FETCH_COLUMN);

        return !((boolean) $exists);
    }
protected function isNewRecord(DeliveryMonitoringDataInterface $deliveryMonitoring)
    {
        $data = $deliveryMonitoring->get();
        $deliveryExecutionId = $data[self::COLUMN_DELIVERY_EXECUTION_ID];

        $sql = "SELECT EXISTS( " . PHP_EOL .
            "SELECT " . self::COLUMN_DELIVERY_EXECUTION_ID . PHP_EOL .
            "FROM " . self::TABLE_NAME . PHP_EOL .
            "WHERE " . self::COLUMN_DELIVERY_EXECUTION_ID . "=?)";
        $exists = $this->getPersistence()->query($sql, [$deliveryExecutionId])->fetch(\PDO::FETCH_COLUMN);

        return !((boolean) $exists);
    }
protected function isNewRecord ( DeliveryMonitoringDataInterface $ deliveryMonitoring ) { $ data = $ deliveryMonitoring -> get ( ) ; $ deliveryExecutionId = $ data [ self :: COLUMN_DELIVERY_EXECUTION_ID ] ; $ sql = "SELECT EXISTS( " . PHP_EOL . "SELECT " . self :: COLUMN_DELIVERY_EXECUTION_ID . PHP_EOL . "FROM " . self :: TABLE_NAME . PHP_EOL . "WHERE " . self :: COLUMN_DELIVERY_EXECUTION_ID . "=?)" ; $ exists = $ this -> getPersistence ( ) -> query ( $ sql , [ $ deliveryExecutionId ] ) -> fetch ( \ PDO :: FETCH_COLUMN ) ; return ! ( ( boolean ) $ exists ) ; }
Check if record for delivery execution already exists in the storage.
@todo add isNewRecord property to DeliveryMonitoringDataInterface to prevent repeated queries to DB.
@param DeliveryMonitoringDataInterface $deliveryMonitoring
@return boolean
Check if record for delivery execution already exists in the storage .