protected function _afterEntityDelete(AnCommandContext $context)
    {
        $total = $this->set->photos->reset()->getTotal();

        if ($total > 0) {
            $this->set->setValue('photo_count', $this->set->photos->reset()->getTotal());
        } else {
            $this->set->delete();
        }
    }
protected function _afterEntityDelete(AnCommandContext $context)
    {
        $total = $this->set->photos->reset()->getTotal();

        if ($total > 0) {
            $this->set->setValue('photo_count', $this->set->photos->reset()->getTotal());
        } else {
            $this->set->delete();
        }
    }
protected function _afterEntityDelete ( AnCommandContext $ context ) { $ total = $ this -> set -> photos -> reset ( ) -> getTotal ( ) ; if ( $ total > 0 ) { $ this -> set -> setValue ( 'photo_count' , $ this -> set -> photos -> reset ( ) -> getTotal ( ) ) ; } else { $ this -> set -> delete ( ) ; } }
After deleting a relationship, set the photo count for the set;.

AnCommandContext $context Context
After deleting a relationship set the photo count for the set ; .