@@ -587,6 +587,21 @@ static PHP_METHOD(Session, endSession)
587
587
intern -> client_session = NULL ;
588
588
} /* }}} */
589
589
590
+ /* {{{ proto bool MongoDB\Driver\Session::isDirty()
591
+ Returns whether the session is dirty (i.e. was used with a command that
592
+ encountered a network error) and will be discarded when returned to the
593
+ server session pool. */
594
+ static PHP_METHOD (Session , isDirty )
595
+ {
596
+ php_phongo_session_t * intern = Z_SESSION_OBJ_P (getThis ());
597
+
598
+ SESSION_CHECK_LIVELINESS (intern , "isDirty" )
599
+
600
+ PHONGO_PARSE_PARAMETERS_NONE ();
601
+
602
+ RETVAL_BOOL (mongoc_client_session_get_dirty (intern -> client_session ));
603
+ } /* }}} */
604
+
590
605
/* {{{ proto void MongoDB\Driver\Session::isInTransaction(void)
591
606
Returns whether a multi-document transaction is in progress */
592
607
static PHP_METHOD (Session , isInTransaction )
@@ -636,6 +651,7 @@ static zend_function_entry php_phongo_session_me[] = {
636
651
PHP_ME (Session , getServer , ai_Session_void , ZEND_ACC_PUBLIC | ZEND_ACC_FINAL )
637
652
PHP_ME (Session , getTransactionOptions , ai_Session_void , ZEND_ACC_PUBLIC | ZEND_ACC_FINAL )
638
653
PHP_ME (Session , getTransactionState , ai_Session_void , ZEND_ACC_PUBLIC | ZEND_ACC_FINAL )
654
+ PHP_ME (Session , isDirty , ai_Session_void , ZEND_ACC_PUBLIC | ZEND_ACC_FINAL )
639
655
PHP_ME (Session , isInTransaction , ai_Session_void , ZEND_ACC_PUBLIC | ZEND_ACC_FINAL )
640
656
PHP_ME (Session , startTransaction , ai_Session_startTransaction , ZEND_ACC_PUBLIC | ZEND_ACC_FINAL )
641
657
ZEND_NAMED_ME (__construct , PHP_FN (MongoDB_disabled___construct ), ai_Session_void , ZEND_ACC_PRIVATE | ZEND_ACC_FINAL )
@@ -779,6 +795,12 @@ static HashTable* php_phongo_session_get_debug_info(phongo_compat_object_handler
779
795
ADD_ASSOC_NULL_EX (& retval , "server" );
780
796
}
781
797
798
+ if (intern -> client_session ) {
799
+ ADD_ASSOC_BOOL_EX (& retval , "dirty" , mongoc_client_session_get_dirty (intern -> client_session ));
800
+ } else {
801
+ ADD_ASSOC_NULL_EX (& retval , "dirty" );
802
+ }
803
+
782
804
if (intern -> client_session ) {
783
805
ADD_ASSOC_BOOL_EX (& retval , "inTransaction" , mongoc_client_session_in_transaction (intern -> client_session ));
784
806
} else {
0 commit comments